public class GetGsmSignalStrength extends Activity
{
/* 我们可以用它们onResume和onPause方法停止listene*/
TelephonyManager Tel;
MyPhoneStateListener MyListener;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
(savedInstanceState);
setContentView();
/* Update the listener, and start it */
MyListener = new MyPhoneStateListener();
Tel = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE);
(MyListener ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
}
/* Called when the application is minimized */
@Override
protected void onPause()
{
();
(MyListener, PhoneStateListener.LISTEN_NONE);
}
/* Called when the application resumes */
@Override
protected void onResume()
{
();
(MyListener,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
}
/* —————————– */
/* 开始PhoneState听众*/
/* —————————– */
private class MyPhoneStateListener extends PhoneStateListener
{
/* 从得到的信号强度,每个tiome供应商有更新*/
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength)
{
(signalStrength);
(getApplicationContext(), "Go to Firstdroid!!! GSM Cinr = "
+ (()), Toast.LENGTH_SHORT).show();
}
};
}