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

Create Network Access Point Name with code,

I will give some examples: Getting default APN information: //path to APN table final Uri APN_TABLE_URI = Uri.parse(“content://telephony/carriers”); //path to preffered APNs final Uri PREFERRED_APN_URI = Uri.parse(“content://telephony/carriers/preferapn”); //receiving cursor to preffered APN table Cursor c = getContentResolver().query(PREFERRED_APN_URI, null, null, null, null); //moving the cursor to beggining of the table c.moveToFirst(); //now the cursor points to … Read more

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

Get CellID, MCC, MNC, LAC, and Network in iOS 5.1

I know three ways on how you can do it on iOS 5.x – 7.x. All of them use private APIs from CoreTelephony.framework. Supports both GSM and UMTS. 1) Using cell monitor struct CTResult { int flag; int a; }; extern CFStringRef const kCTCellMonitorCellType; extern CFStringRef const kCTCellMonitorCellTypeServing; extern CFStringRef const kCTCellMonitorCellTypeNeighbor; extern CFStringRef const … Read more

How to determine if network type is 2G, 3G or 4G

You can put this following method directly in your Utility class: Kotlin: /** Usage: `networkTypeClass(telephonyManager.networkType)` */ fun networkTypeClass(networkType: Int): String { when (networkType) { TelephonyManager.NETWORK_TYPE_GPRS, TelephonyManager.NETWORK_TYPE_EDGE, TelephonyManager.NETWORK_TYPE_CDMA, TelephonyManager.NETWORK_TYPE_1xRTT, TelephonyManager.NETWORK_TYPE_IDEN, TelephonyManager.NETWORK_TYPE_GSM -> return “2G” TelephonyManager.NETWORK_TYPE_UMTS, TelephonyManager.NETWORK_TYPE_EVDO_0, TelephonyManager.NETWORK_TYPE_EVDO_A, TelephonyManager.NETWORK_TYPE_HSDPA, TelephonyManager.NETWORK_TYPE_HSUPA, TelephonyManager.NETWORK_TYPE_HSPA, TelephonyManager.NETWORK_TYPE_EVDO_B, TelephonyManager.NETWORK_TYPE_EHRPD, TelephonyManager.NETWORK_TYPE_HSPAP, TelephonyManager.NETWORK_TYPE_TD_SCDMA -> return “3G” TelephonyManager.NETWORK_TYPE_LTE -> return “4G” TelephonyManager.NETWORK_TYPE_NR -> return “5G” else … Read more

How can i turn off 3G/Data programmatically on Android?

There is no official way to do this. However, it can be achieved unofficially with reflection. For Android 2.3 and above: private void setMobileDataEnabled(Context context, boolean enabled) { final ConnectivityManager conman = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final Class conmanClass = Class.forName(conman.getClass().getName()); final Field iConnectivityManagerField = conmanClass.getDeclaredField(“mService”); iConnectivityManagerField.setAccessible(true); final Object iConnectivityManager = iConnectivityManagerField.get(conman); final Class iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName()); … Read more

iOS Detect 3G or WiFi

Using the code that Apple has provided here Reachability *reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier]; NetworkStatus status = [reachability currentReachabilityStatus]; if(status == NotReachable) { //No internet } else if (status == ReachableViaWiFi) { //WiFi } else if (status == ReachableViaWWAN) { //3G }