2013-04-22 45 views
1

我目前正在編寫一個測試信號強度的Android應用程序。但是,我有一個關於信號強度讀數的問題。此代碼在其他設備上完美無瑕。但是當我嘗試過摩托羅拉(Froyo)時,它返回99-UNUNOWN(信號強度)。有關這個問題的任何想法?謝謝。onSignalStrengthsChanged返回未知信號強度99 asu

目前我使用此代碼:根據Android的API

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 
    signalStrengthListener = new SignalStrengthListener(); 
    ((TelephonyManager)getSystemService(TELEPHONY_SERVICE)). 
    listen(signalStrengthListener,SignalStrengthListener.LISTEN_SIGNAL_STRENGTHS); 
} 

private class SignalStrengthListener extends PhoneStateListener{ 
@Override 
public void onSignalStrengthsChanged(android.telephony.SignalStrength signalStrength) { 
int strengthAmplitude = signalStrength.getGsmSignalStrength(); 
Toast.makeText(getApplicationContext(),strengthAmplitude, Toast.LENGTH_LONG).show(); 
super.onSignalStrengthsChanged(signalStrength);  
}} 

回答