Commit 46d2412f authored by Mickaël Turnel's avatar Mickaël Turnel

Fix unregister callback compatibility

parent 29a339be
......@@ -153,18 +153,26 @@ public class AndroidPlatformHelper {
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mDozeIntentFilter = new IntentFilter();
mDozeIntentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED);
mDozeReceiver = new DozeReceiver(this);
dozeModeEnabled = ((PowerManager) mContext.getSystemService(Context.POWER_SERVICE)).isDeviceIdleMode();
mContext.registerReceiver(mDozeReceiver, mDozeIntentFilter);
mDozeIntentFilter = new IntentFilter();
mDozeIntentFilter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED);
mDozeReceiver = new DozeReceiver(this);
dozeModeEnabled = ((PowerManager) mContext.getSystemService(Context.POWER_SERVICE)).isDeviceIdleMode();
mContext.registerReceiver(mDozeReceiver, mDozeIntentFilter);
}
postNetworkUpdateRunner();
}
public synchronized void onLinphoneCoreStop() {
mNetworkManagerAbove21.unregisterNetworkCallbacks(mConnectivityManager);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
mContext.unregisterReceiver(mNetworkReceiver);
} else {
mNetworkManagerAbove21.unregisterNetworkCallbacks(mConnectivityManager);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mContext.unregisterReceiver(mDozeReceiver);
}
mNativePtr = 0;
mMainHandler.removeCallbacks(mNetworkUpdateRunner);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment