The setup
Problem
Recently my ISP came up with an additional security system.On first connect(could be from any device) I need to authenticate myself with a username/password to my ISP website. I checked the system and they were intercepting the first http connection from my side and redirecting my browser to their login page. Some how my android browsers are not able to show this login page. I need to connect using my laptop and only later android devices can connect to internet.
My Solution
I wrote a small java application to over come this problem. It tries to connect to google.com. Intercept the redirect request and finally post my username password. The application is working fine with my laptop and I hooked it with windows start up and everything is great. Android devices still are not very happy with this app. On debugging I find that my very first socket connections is getting timed out and my application fails.
Technical Details
Device - Motorola Defy Plus
Android version - 2.3.3
Exception Socket - Time out
Code
public class SocketHttp {
public static Socket connect(String ip) throws Exception {
Socket socket = new Socket(ip, 80);
return socket;
}
.....
}
As I have not logged in to my ISP I am not depending on the DNS service and directly hardcoding a google.com IP.I have added
<uses-permission android:name="android.permission.INTERNET" /> in the Android Manifest. The code works correctly if the ISP login is completed using my lap top.
Any idea what is going wrong?
Regards
Anand G
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment