本文整理汇总了Java中android.telephony.SubscriptionManager.removeOnSubscriptionsChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java SubscriptionManager.removeOnSubscriptionsChangedListener方法的具体用法?Java SubscriptionManager.removeOnSubscriptionsChangedListener怎么用?Java SubscriptionManager.removeOnSubscriptionsChangedListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.SubscriptionManager
的用法示例。
在下文中一共展示了SubscriptionManager.removeOnSubscriptionsChangedListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDestroy
import android.telephony.SubscriptionManager; //导入方法依赖的package包/类
@Override
public void onDestroy() {
Log.i(TAG, "Destroy");
commandLooper.quit();
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();
}
示例2: onDestroy
import android.telephony.SubscriptionManager; //导入方法依赖的package包/类
@Override
public void onDestroy() {
Log.i(TAG, "Destroy");
commandLooper.quit();
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();
}