Example usage for android.telephony PhoneStateListener LISTEN_NONE

List of usage examples for android.telephony PhoneStateListener LISTEN_NONE

Introduction

In this page you can find the example usage for android.telephony PhoneStateListener LISTEN_NONE.

Prototype

int LISTEN_NONE

To view the source code for android.telephony PhoneStateListener LISTEN_NONE.

Click Source Link

Document

Stop listening for updates.

Usage

From source file:com.secupwn.aimsicd.ui.activities.MapViewerOsmDroid.java

@Override
protected void onDestroy() {
    super.onDestroy();
    prefs.unregisterOnSharedPreferenceChangeListener(this);
    // Unbind from the service
    if (mBound) {
        unbindService(mConnection);/*from ww  w .  j  a  v  a 2  s . c om*/
        mBound = false;
    }

    TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);

    LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
}

From source file:com.SecUpwN.AIMSICD.activities.MapViewerOsmDroid.java

@Override
protected void onDestroy() {
    super.onDestroy();
    prefs.unregisterOnSharedPreferenceChangeListener(this);
    // Unbind from the service
    if (mBound) {
        mContext.unbindService(mConnection);
        mBound = false;//from   ww  w . jav  a  2  s .  c  o m
    }

    TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);

    LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
}

From source file:com.cc.signalinfo.activities.MainActivity.java

@Override
public void onPause() {
    super.onPause();
    tm.listen(listener, PhoneStateListener.LISTEN_NONE);
}

From source file:com.SecUpwN.AIMSICD.fragments.MapFragment.java

@Override
public void onDestroyView() {
    super.onDestroy();

    LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mMessageReceiver);
    if (mCompassOverlay != null) {
        mCompassOverlay.disableCompass();
    }/*from   www  .  ja v a  2s  . c  o m*/

    if (mMyLocationOverlay != null) {
        mMyLocationOverlay.disableMyLocation();
    }

    prefs.unregisterOnSharedPreferenceChangeListener(this);
    // Unbind from the service
    if (mBound) {
        getActivity().unbindService(mConnection);
        mBound = false;
    }

    TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);

    LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mMessageReceiver);
}

From source file:com.secupwn.aimsicd.ui.fragments.MapFragment.java

@Override
public void onDestroyView() {
    super.onDestroyView();

    LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mMessageReceiver);
    if (mCompassOverlay != null) {
        mCompassOverlay.disableCompass();
    }/* w ww. j  a  v  a2s . c  o  m*/

    if (mMyLocationOverlay != null) {
        mMyLocationOverlay.disableMyLocation();
    }

    if (prefs != null) {
        prefs.unregisterOnSharedPreferenceChangeListener(this);
    }
    // Unbind from the service
    if (mBound) {
        getActivity().unbindService(mConnection);
        mBound = false;
    }

    TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);

    LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(mMessageReceiver);
}

From source file:com.ultrafunk.network_info.service.NetworkStateService.java

private void mobileDataDestroy() {
    if (mobileDataStatusReceiver != null) {
        telephonyManager.listen(mobileDataStateListener, PhoneStateListener.LISTEN_NONE);
        mobileDataStateListener = null;//from ww w  .  j  a va  2  s. c o m

        getContentResolver().unregisterContentObserver(mobileDataSettingObserver);
        mobileDataSettingObserver = null;

        localBroadcastManager.unregisterReceiver(mobileDataStatusReceiver);
        unregisterReceiver(mobileDataStatusReceiver);
        mobileDataStatusReceiver = null;
    }
}

From source file:se.team05.service.MediaService.java

/**
 * When the service is being destroyed we need to clean up so we release the
 * mediaplayer memory back to the system and remove the listener for the
 * phone state changes from the telephone manager. Finally we remove the
 * notification./*w w w . j  ava  2  s .  c  o  m*/
 */
@Override
public void onDestroy() {
    super.onDestroy();
    if (mediaPlayer != null) {
        stopMedia();
        mediaPlayer.release();
    }

    if (phoneStateListener != null) {
        telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
    }

    cancelNotification();
}

From source file:jp.morihirosoft.twwb.TwwbService.java

private void unregisterReceivers() {
    if (DEBUG)//w  w  w  .  ja  va 2 s.co m
        Log.d(TAG, "unregisterReceivers");
    if (mIsRegistered) {
        mIsRegistered = false;
        unregisterReceiver(mReceiverScreenOn);
        unregisterReceiver(mReceiverScreenOff);
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
        LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
        lbm.unregisterReceiver(mReceiverRecognition);
    }
}

From source file:com.secupwn.aimsicd.service.CellTracker.java

public void stop() {
    if (isMonitoringCell()) {
        setCellMonitoring(false);// w  w w  . j a va 2s  .  c o  m
    }
    if (isTrackingCell()) {
        setCellTracking(false);
    }
    if (isTrackingFemtocell()) {
        stopTrackingFemto();
    }
    cancelNotification();
    tm.listen(cellSignalListener, PhoneStateListener.LISTEN_NONE);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

}

From source file:com.tvs.signaltracker.STService.java

private void StopWorks() {
    if (CommonHandler.ServiceMode < 3)
        ServiceHandler.removeCallbacks(ReSendRun);
    Log.i("SignalTracker::STService", "Stopping works");
    try {/*from   w ww  .  java 2  s . c o m*/
        if (mlocManager != null) {
            mlocManager.removeGpsStatusListener(GPSs);
            mlocManager.removeUpdates(GPSLocListener);
            mlocManager.removeUpdates(NetLocListener);
        }
        if (Tel != null)
            Tel.listen(MyListener, PhoneStateListener.LISTEN_NONE);
    } catch (Exception e) {
    }
    try {
        String ns = Context.NOTIFICATION_SERVICE;
        NotificationManager nMgr = (NotificationManager) this.getSystemService(ns);
        nMgr.cancel(NOTIFICATION);
    } catch (Exception e) {
    }

    GPSs = null;
    GPSLocListener = null;
    NetLocListener = null;
    CommonHandler.GPSFix = false;
    CommonHandler.NumSattelites = 0;
    Toast.makeText(getApplicationContext(), getResources().getString(R.string.stservicestopped),
            Toast.LENGTH_LONG).show();
    LocalRunning = false;
    stopForeground(true);
}