Determine if LTE is turned on?
Asked Answered
C

2

7

I am trying to write a widget so I can enable/disable LTE on my Verizon Galaxy Nexus without going deep into the settings menu to do so. However, I have yet to figure out how to determine if LTE is actually turned on. I can determine if my phone currently has a LTE signal or an EVDO signal, but not if LTE is enabled when the phone has an EVDO signal.

Does anyone have some suggestions on where to look in the Android Developers Reference? I have tried TelephonyManager & ConnectivityManager but so far neither is working for me.

Cordate answered 11/6, 2012 at 19:58 Comment(0)
S
0

Have you tried this?

TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService( Context.TELEPHONY_SERVICE );
boolean isLTEConnected = telephonyManager.getNetworkType() == TelephonyManager.NETWORK_TYPE_LTE;
Shudder answered 11/6, 2012 at 20:4 Comment(3)
I currently have LTE enabled on my phone but am on a CDMA connection, that returns false. Thats what I got stuck on earlier. It "should" work if one thinks logically, but it only works if you have an active LTE connection. Directly from the Android Developer Reference "public int getNetworkType () Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission."Cordate
You may check the ConnectivityManager, using a combination of getNetworkInfo(ConnectivityManager.TYPE_MOBILE) and NetworkInfo.getTypeName(), though I'm not sure if that'll get you what you want.Shudder
NetworkInfo.getTypeName() returns "MOBILE" or "WIFI". One would think Google would add proper support for LTE like they did WiMAX since WiMAX is dead and even Sprint switched to LTE. Also, ConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).toString() returns "06-11 15:33:32.239: W/LTE Toggle Widget(12811): NetworkInfo: type: mobile[CDMA - eHRPD], state: CONNECTED/CONNECTED, reason: simLoaded, extra: VZWINTERNET, roaming: false, failover: false, isAvailable: true" in LogCat.Cordate
G
0

See this link : http://developer.android.com/reference/android/telephony/TelephonyManager.html and on this you can find an example : http://developer.android.com/training/efficient-downloads/connectivity_patterns.html

You have to use the following function : TelephonyManager.getNetworkType()

Governorship answered 11/6, 2012 at 20:5 Comment(12)
I am using TelephonyManager.getNetworkType(), but it returns CDMA even if LTE is enabled but I have only a CDMA data connection. To me it makes no sense that there isn't an easy way to determine if LTE is enabled (even if it isn't the current active connection). Directly from the Android Developer Reference "public int getNetworkType () Returns a constant indicating the radio technology (network type) currently in use on the device for data transmission."Cordate
Yes, which so far I haven't figured out how to get (unless I just overlooked it which is possible).Cordate
Thought ConnectivityManager.getNetworkPreference() might be what I need but it returns "1" with LTE on & LTE off so that isn't it.Cordate
It's weird, because I pretty sure that if you put off the LTE, the preferred network change, because I think it's the same way than you put off/on the 3G. I haven't a LTE phone, but put off and on the LTE and watch in phone info (#*#4636#*# on the phone dial > Phone Info)Governorship
For some reason #*#4636#*# doesn't work on my Galaxy Nexus. Maybe it doesn't work on ICS?Cordate
Got it working, its #*#4636#*# and with LTE on and off it shows "GSM/CDMA auto (PRL)" for the prefered network. Must be due to the fact that it uses GSM for LTE and CDMA for 3G/1x?Cordate
It's because I forgot an * at the endGovernorship
No, it removes the leading and trailing . Did it to me too.... It is "*#*#4636#*#*"Cordate
Yeah, this one work one my phone, I'm pretty it works on yours tooGovernorship
Yep, that worked. Unfortunately it still shows "GSM/CDMA auto (PRL)" as my preferred network with LTE on & off :(Cordate
So, I'm sorry but I don't another method, to find something like that.Governorship
No problem. I haven't given up yet, just thinking about it more.Cordate

© 2022 - 2024 — McMap. All rights reserved.