• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Cellular Strength Detection Code

EsJa

Lurker
Apr 18, 2019
1
0
There was app NoSignalAlert which is not available anymore. Does anyone know why it was taken down?

We want to determine the cellular strength and then build something based on it. Does anyone know if it is possible to determine cellular strength and if it is does the api keep on changing to do it ?
 
Try this, courtesy of StackOverflow https://stackoverflow.com/questions/19805880/get-signal-strength-in-android

Define Variables:

TelephonyManager mTelephonyManager;
MyPhoneStateListener mPhoneStatelistener;
int mSignalStrength = 0;
Then add this class to your code:

class MyPhoneStateListener extends PhoneStateListener {

@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
mSignalStrength = signalStrength.getGsmSignalStrength();
mSignalStrength = (2 * mSignalStrength) - 113; // -> dBm
}
}
and in your onCreate method use:

mPhoneStatelistener = new MyPhoneStateListener();
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mTelephonyManager.listen(mPhoneStatelistener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones