gprs

Google Android - how to figure out if 3g and 2g is turned on

泄露秘密 提交于 2019-11-27 13:13:58
问题 I'm developing a simple application for the Google Android to turn on and off the wifi or 3g or 2g. I see http://developer.android.com/reference/android/net/wifi/WifiManager.html#isWifiEnabled() that you can see if the wifi is enabled or disabled and also us http://developer.android.com/reference/android/net/wifi/WifiManager.html#setWifiEnabled(boolean) to turn on and off the wifi. I'm wondering if it's possible to do the same for 3G and for 2G/GPRS? I know it's possible because you can turn

Android, How to handle change in network (from GPRS to Wi-fi and vice-versa) while polling for data

淺唱寂寞╮ 提交于 2019-11-27 12:31:39
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

Scan for available Wi-Fi networks on BlackBerry

 ̄綄美尐妖づ 提交于 2019-11-27 07:14:13
问题 Is there any RIM API available which will help to get the list of available network service or only Wi-Fi networks for a device and set selected network access point for any network communications? Is it possible for my application to disable the mobile networks like GPRS, WAP, etc.? Example: When the application is started it should scan for Wi-Fi connections, even if there are no previous Wi-Fi network access points set on the device, and list the available Wi-Fi connections. Then the user

Enable/Disable Mobile Data (GPRS) using code

筅森魡賤 提交于 2019-11-27 02:25:33
问题 I was having one solution for enabling and disabling data that was working good in API 8 and 10, but that code was not compatible with the ICS, I need a global solution, so that the same code must be compatible from API 8 to till date Android OS versions. 回答1: Use the following method. It'll work with all android versions. int bv = Build.VERSION.SDK_INT; boolean turnOnDataConnection(boolean ON,Context context) { try{ if(bv == Build.VERSION_CODES.FROYO) { Method dataConnSwitchmethod; Class<?>

How to provide option to select wi-fi or GPRS for network connectivity in android app

萝らか妹 提交于 2019-11-26 23:05:53
问题 In my app i want to provide the user with the option to choose wi-fi / GPRS for network connectivity to the web server. May be answers to the following ques solve my prob ... 1. How to check which is the current default network connectivity option enabled. 2. How to enable wi-fi/GPRS on user selection or (disable the wi-fi if user chooses GPRS - if only this option will be required for GPRS to work) or is there some other way around to do this ? 回答1: Try this: ConnectivityManager connManager

Android, How to handle change in network (from GPRS to Wi-fi and vice-versa) while polling for data

杀马特。学长 韩版系。学妹 提交于 2019-11-26 16:02:20
问题 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 回答1: You can set up a Receiver in your manifest: <receiver android:name=".NetworkChangeReceiver" android:label="NetworkChangeReceiver"> <intent

Enable/disable data connection in android programmatically

我与影子孤独终老i 提交于 2019-11-26 01:06:46
问题 I want to enable/disable the data connection programmatically. I\'ve used the following code: void enableInternet(boolean yes) { ConnectivityManager iMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); Method iMthd = null; try { iMthd = ConnectivityManager.class.getDeclaredMethod(\"setMobileDataEnabled\", boolean.class); } catch (Exception e) { } iMthd.setAccessible(false); if(yes) { try { iMthd.invoke(iMgr, true); Toast.makeText(getApplicationContext(), \"Data

Enable/disable data connection in android programmatically

此生再无相见时 提交于 2019-11-26 00:42:56
I want to enable/disable the data connection programmatically. I've used the following code: void enableInternet(boolean yes) { ConnectivityManager iMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); Method iMthd = null; try { iMthd = ConnectivityManager.class.getDeclaredMethod("setMobileDataEnabled", boolean.class); } catch (Exception e) { } iMthd.setAccessible(false); if(yes) { try { iMthd.invoke(iMgr, true); Toast.makeText(getApplicationContext(), "Data connection Enabled", Toast.LENGTH_SHORT).show(); } catch (IllegalArgumentException e) { // TODO Auto-generated