0

I am trying to find user location using The Google Maps Geolocation API. While using this API I need to pass radiotype in JSON request body to get the more accurate location from the cell tower. Supported values for radiotype are lte, gsm, cdma, and wcdma.

Kindly help me in finding radiotype in android.

Community
  • 1
  • 1
Nikhil Pawar
  • 181
  • 3
  • 15

1 Answers1

1

Try one of the following:

NetworkInfo info = Connectivity.getNetworkInfo(context);
int type = info.getType(); // wifi or radio
int subType = info.getSubType(); // which is what u want
String radioType = null;

you can switch over them like so to look for types you are interested in

switch(subType){
    case TelephonyManager.NETWORK_TYPE_CDMA:
        radioType = "cdma"
        break;
    case TelephonyManager.NETWORK_TYPE_GSM:
        radioType = "gsm"
        break;
    //more checks you are interested in ie
    //case TelephonyManager.NETWORK_TYPE_***
}
Rafael T
  • 15,401
  • 15
  • 83
  • 144
  • In some cases people using Reliance Jio SIM card which supports only `lte` type. How can I get such radio type? How to get `wcdma` radio type? – Nikhil Pawar Sep 19 '17 at 16:40
  • Man, please start thinking yourself! Its a crucial programming skill. But for the sake of argument look at https://developer.android.com/reference/android/telephony/TelephonyManager.html and see a plethora of other TelephonyManager constants – Rafael T Sep 19 '17 at 16:42
  • @NikhilPawar If this answer solved your problem remember to mark it as accepted for fellow devs who got the same problem. Also a high accepted rate might improve willingness by other devs to answer your questions – Rafael T Sep 20 '17 at 13:39