Code example for TelephonyManager

Methods: getPhoneType, listen

0
 
    CellScanner(Context context) {
        mContext = context;
 
        TelephonyManager tm = getTelephonyManager();
        mRadioType = getRadioTypeName((tm != null) ? tm.getPhoneType() : TelephonyManager.PHONE_TYPE_NONE);
 
        tm.listen(this, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
    } 
 
    public void start() { 
        mCellScanTimer = new Timer();
 
        mCellScanTimer.schedule(new TimerTask() {
                @Override 
                public void run() { 
                    Log.d(LOGTAG, "Cell Scanning Timer fired");
                    getCellInfo(); 
                } 
            }, 0, CELL_MIN_UPDATE_TIME);
    }