Wifi sleeps, even with Lock

There are numerous bugs on the Android bug tracker to do with wifi sleep/power saving mode and even apps available that attempt to rectify this. So it is quite likely that you are not doing anything wrong. http://code.google.com/p/android/issues/detail?id=9781 http://code.google.com/p/android/issues/detail?id=1698 Also check out wififixer which is an open source project which may help you with code … Read more

Web site exhibits JavaScript error on iPad / iPhone under 3G but not under WiFi

I’ve investigated this further and discovered that the problem is that the UK mobile operator O2 (the original exclusive iPhone operator for Apple), modifies web content before sending it to iPhones and iPads. Probably before sending it to any device running a mobile browser. They non-deterministically inline some of the CSS and JavaScript into the … Read more

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

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.WIFI_STATE_CHANGED” /> </intent-filter> </receiver> And implement the Receiver with something like this: public class NetworkChangeReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { final ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final android.net.NetworkInfo wifi = … Read more

Get signal strength of WIFI and Mobile Data

Wifi: WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); int linkSpeed = wifiManager.getConnectionInfo().getRssi(); In case of mobile it should work: TelephonyManager telephonyManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); CellInfoGsm cellinfogsm = (CellInfoGsm)telephonyManager.getAllCellInfo().get(0); CellSignalStrengthGsm cellSignalStrengthGsm = cellinfogsm.getCellSignalStrength(); cellSignalStrengthGsm.getDbm(); Then You should compare this signal levels and if WIFI signal is better keep it turn on, but if mobile is better disconnect wifi

Android : Check 3G or Wifi network is ON or Available or not on android Device

TO check whether network i.e 3G or WiFi is available or not we can use below methods to verify before starting our activities. ConnectivityManager manager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); //For 3G check boolean is3g = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) .isConnectedOrConnecting(); //For WiFi Check boolean isWifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) .isConnectedOrConnecting(); System.out.println(is3g + ” net ” + isWifi); if (!is3g && !isWifi) … Read more