如何在Android上检索GSM信号质量参数?

时间:2010-11-13 12:46:43

标签: java android parameters gsm

我试图找出任何检索BER和CIR等质量参数的方法。我在谷歌和Android开发者网站上唯一能找到的是getGsmBitErrorRate(),但它似乎一直显示-1。那么有没有办法以其他方式获得质量参数?或者我可能只是做错了什么?

1 个答案:

答案 0 :(得分:1)

这对你有用吗?

    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);