Android, How to handle change in network (from GPRS to Wi-fi and vice-versa) while polling for data
I use DefaultHttpClient and HttpGet to poll data from server. Now, say a user was in Wi-fi network and moves out of the room. So the phone automatically starts using the 3G network. Are there any call-backs for such change, and how should I handle such changes. Should I start polling again or does the OS take care to make the changes appropriately You can set up a Receiver in your manifest: <receiver android:name=".NetworkChangeReceiver" android:label="NetworkChangeReceiver"> <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> <action android:name="android.net.wifi