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.service.AimsicdService.java

/**
 * Stop FemtoCell detection tracking//w  w w.j a v a  2  s . c  om
 * CDMA Devices ONLY
 */
public void stopTrackingFemto() {
    if (mPhoneStateListener != null) {
        tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
        mTrackingFemtocell = false;
        setNotification();
        Log.v(TAG, "Stopped tracking Femtocell connections");
    }
}

From source file:eu.faircode.adblocker.ServiceSinkhole.java

@Override
public void onDestroy() {
    Log.i(TAG, "Destroy");

    commandLooper.quit();//  w ww. j  av  a2s.co  m
    logLooper.quit();
    statsLooper.quit();

    unregisterReceiver(interactiveStateReceiver);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        unregisterReceiver(powerSaveReceiver);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
        unregisterReceiver(userReceiver);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        unregisterReceiver(idleStateReceiver);
    unregisterReceiver(connectivityChangedReceiver);
    unregisterReceiver(packageAddedReceiver);

    if (phone_state) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (tm != null) {
            tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
            phone_state = false;
        }
    }

    if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        SubscriptionManager sm = SubscriptionManager.from(this);
        sm.removeOnSubscriptionsChangedListener(
                (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener);
        subscriptionsChangedListener = null;
    }

    try {
        if (vpn != null) {
            stopNative(vpn, true, true);
            stopVPN(vpn);
            vpn = null;
            unprepare();
        }
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    jni_done();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    super.onDestroy();
}

From source file:com.master.metehan.filtereagle.ServiceSinkhole.java

@Override
public void onDestroy() {
    Log.i(TAG, "Destroy");

    commandLooper.quit();/*w  w  w  .ja v a 2s. c  o  m*/
    logLooper.quit();
    statsLooper.quit();

    if (registeredInteractiveState) {
        unregisterReceiver(interactiveStateReceiver);
        registeredInteractiveState = false;
    }
    if (registeredPowerSave) {
        unregisterReceiver(powerSaveReceiver);
        registeredPowerSave = false;
    }
    if (registeredUser) {
        unregisterReceiver(userReceiver);
        registeredUser = false;
    }
    if (registeredIdleState) {
        unregisterReceiver(idleStateReceiver);
        registeredIdleState = false;
    }
    if (registeredConnectivityChanged) {
        unregisterReceiver(connectivityChangedReceiver);
        registeredConnectivityChanged = false;
    }
    if (registeredPackageAdded) {
        unregisterReceiver(packageAddedReceiver);
        registeredPackageAdded = false;
    }

    if (phone_state) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (tm != null) {
            tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
            phone_state = false;
        }
    }

    if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        SubscriptionManager sm = SubscriptionManager.from(this);
        sm.removeOnSubscriptionsChangedListener(
                (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener);
        subscriptionsChangedListener = null;
    }

    try {
        if (vpn != null) {
            stopNative(vpn, true, true);
            stopVPN(vpn);
            vpn = null;
            unprepare();
        }
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    jni_done();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    super.onDestroy();
}

From source file:com.zhengde163.netguard.ServiceSinkhole.java

@Override
public void onDestroy() {
    Log.i(TAG, "Destroy");

    commandLooper.quit();//  w  w w.  j a  v  a  2 s .  c o m
    logLooper.quit();
    statsLooper.quit();

    if (registeredInteractiveState) {
        unregisterReceiver(interactiveStateReceiver);
        registeredInteractiveState = false;
    }
    if (registeredPowerSave) {
        unregisterReceiver(powerSaveReceiver);
        registeredPowerSave = false;
    }
    if (registeredUser) {
        unregisterReceiver(userReceiver);
        registeredUser = false;
    }
    if (registeredIdleState) {
        unregisterReceiver(idleStateReceiver);
        registeredIdleState = false;
    }
    if (registeredConnectivityChanged) {
        unregisterReceiver(connectivityChangedReceiver);
        registeredConnectivityChanged = false;
    }
    if (registeredPackageAdded) {
        unregisterReceiver(packageAddedReceiver);
        registeredPackageAdded = false;
    }

    if (phone_state) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (tm != null) {
            tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
            phone_state = false;
        }
    }

    if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        SubscriptionManager sm = SubscriptionManager.from(this);
        sm.removeOnSubscriptionsChangedListener(
                (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener);
        subscriptionsChangedListener = null;
    }

    try {
        if (vpn != null) {
            stopNative(vpn, true, true);
            stopVPN(vpn);
            vpn = null;
            unprepare();
        }
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    jni_done();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);
    Intent localIntent = new Intent();
    localIntent.setClass(this, ServiceSinkhole.class); //???Service
    this.startService(localIntent);
    super.onDestroy();
}

From source file:android_network.hetnet.vpn_service.ServiceSinkhole.java

@Override
public void onDestroy() {
    Log.i(TAG, "Destroy");

    commandLooper.quit();/*from   ww  w  . ja va2s .co m*/
    logLooper.quit();
    statsLooper.quit();

    if (registeredInteractiveState) {
        unregisterReceiver(interactiveStateReceiver);
        registeredInteractiveState = false;
    }
    if (registeredPowerSave) {
        unregisterReceiver(powerSaveReceiver);
        registeredPowerSave = false;
    }
    if (registeredUser) {
        unregisterReceiver(userReceiver);
        registeredUser = false;
    }
    if (registeredIdleState) {
        unregisterReceiver(idleStateReceiver);
        registeredIdleState = false;
    }
    if (registeredConnectivityChanged) {
        unregisterReceiver(connectivityChangedReceiver);
        registeredConnectivityChanged = false;
    }
    if (registeredPackageAdded) {
        unregisterReceiver(packageAddedReceiver);
        registeredPackageAdded = false;
    }

    if (phone_state) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (tm != null) {
            tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
            phone_state = false;
        }
    }

    if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        SubscriptionManager sm = SubscriptionManager.from(this);
        sm.removeOnSubscriptionsChangedListener(
                (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener);
        subscriptionsChangedListener = null;
    }

    try {
        if (vpn != null) {
            stopNative(vpn, true);
            stopVPN(vpn);
            vpn = null;
            unprepare();
        }
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    jni_done();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    super.onDestroy();
}

From source file:eu.faircode.netguard.ServiceSinkhole.java

@Override
public void onDestroy() {
    Log.i(TAG, "Destroy");

    commandLooper.quit();/*from   w  ww  .ja va 2s.c  om*/
    logLooper.quit();
    statsLooper.quit();

    if (registeredInteractiveState) {
        unregisterReceiver(interactiveStateReceiver);
        registeredInteractiveState = false;
    }
    if (registeredPowerSave) {
        unregisterReceiver(powerSaveReceiver);
        registeredPowerSave = false;
    }
    if (registeredUser) {
        unregisterReceiver(userReceiver);
        registeredUser = false;
    }
    if (registeredIdleState) {
        unregisterReceiver(idleStateReceiver);
        registeredIdleState = false;
    }
    if (registeredConnectivityChanged) {
        unregisterReceiver(connectivityChangedReceiver);
        registeredConnectivityChanged = false;
    }
    if (registeredPackageChanged) {
        unregisterReceiver(packageChangedReceiver);
        registeredPackageChanged = false;
    }

    if (phone_state) {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (tm != null) {
            tm.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
            phone_state = false;
        }
    }

    if (subscriptionsChangedListener != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        SubscriptionManager sm = SubscriptionManager.from(this);
        sm.removeOnSubscriptionsChangedListener(
                (SubscriptionManager.OnSubscriptionsChangedListener) subscriptionsChangedListener);
        subscriptionsChangedListener = null;
    }

    try {
        if (vpn != null) {
            stopNative(vpn, true);
            stopVPN(vpn);
            vpn = null;
            unprepare();
        }
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    jni_done();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.unregisterOnSharedPreferenceChangeListener(this);

    super.onDestroy();
}