How to retrieve GSM signal quality parameters on Android?
I am trying to find out any methods to retrieve quality parameters like 开发者_如何学GoBER and CIR. The only thing I was able to find in Google and in Android Developer website was getGsmBitErrorRate(), but it seems to show -1 for all the time. So is there any way to get quality parameters in other way? Or may be I am just doing something wrong?
Does this work for you?
TelephonyManager SignalManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
PhoneStateListener signalListener = new PhoneStateListener() {
public void onCallForwardingIndicatorChanged(boolean cfi) {
}
public void onCallStateChanged(int state, String incomingNumber) {
}
public void onCellLocationChanged(CellLocation location) {
}
public void onDataActivity(int direction) {
}
public void onDataConnectionStateChanged(int state) {
}
public void onDataConnectionStateChanged(int state, int networkType) {
}
public void onMessageWaitingIndicatorChanged(boolean mwi) {
}
public void onServiceStateChanged(ServiceState serviceState) {
}
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
Log.e("onSignalStrengthsChanged: ", "GSM Cinr = "
+ signalStrength.getGsmSignalStrength());
}
};
SignalManager.listen(signalListener,
PhoneStateListener.LISTEN_SIGNAL_STRENGTH);
精彩评论