开发者

Android - differences between WLAN and 3G connection

I would like to know what exactly the differences are between a WLAN connection to the internet, or a 3G connection to the internet.

I am coding an App which uses session handling, which works fine when I'm connected via WLAN, but not at all when I'开发者_开发技巧m connected via 3G. How can that be? Is there something I need to be aware of that I am not?


For accessing the internet, Android doesn't do anything special relating to the type of connection you're using.

However, there are some potential reasons why your session-handling mechanism may not work:

  • the mobile network you're on may filter out certain packets or items, such as HTTP headers, that your app uses for session tracking
  • if you started a session while on WLAN, then continue your session over a mobile connection, the server will see you have a different IP address - this could cause the server to see you as a separate user
  • similarly, the mobile network could be presenting a different IP to the server with each connection you make from the phone

How does the session-handling mechanism work?
Do you have access to the server so that you could identify any differences between the two types of requests?


I figured out what the problem was. When calling the webservice, I am receiving "HeaderProperties", and one of them contains the cookie I need. When connected via WLAN, I get the cookie with HeaderProperties.get(2).getValue(). However when connected via 3G, .get(2) only contains a timestamp, to get the cookie, I need to get the fourth entry (i.e. HeaderProperties.get(3).getValue()).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜