English 中文(简体)
Android - Connectivity Questions
原标题:

I have a couple of questions about connectivity on Android, if anyone has any insight it would be great.

1) What is the default when an application wants to wirelessly connect? Is it wlan? And if wlan is switched off or there is no access points around is it 3g or gprs?

2) Is a device always ip connected? Or when its disabled from wlan or 3g does it lose its ip address?

3) Is an application, for example the browser only ever connected to one ip address? Or can it be connected to multiple addresses for each radio such as gprs or wifi (wlan)?

4) Can an application decide which connection to open a socket to? For example can I create an application and decide whether to connect the socket to the wlan or gprs? Or does the OS decide?

5) Finally how do native applications handle connectivity? In the same manner?

最佳回答

Similarly to any Linux machine, you have different devices for different network interfaces - e.g. on my device: eth0 for WLAN, rmnet0 for 3G/GPRS (It s impossible to be connected both via 3G and GPRS at the same time). The connected interface receives an IP address, and the kernel s routing tables update so that all packets will be routed through the connected device. Theoretically, you could have both interfaces connected, however, on all Android devices I ve seen, only one network interface will be active at a time (excluding transition periods, when WiFi is being turned on or off, or when a lingering TCP connection is still active).

Usually, native applications don t concern themselves with connecting to the Internet - if there s any kind of connection, it will work; otherwise, the app will receive a connection timeout (or similar error).

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签