• 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
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);
 
Back
Top Bottom