Fix not send expires at 0 on device shutdown if push or background mode

enabled
This commit is contained in:
Erwan Croze 2018-06-07 11:17:31 +02:00
parent 8ce3bc21fa
commit c082aa52fd

View file

@ -906,13 +906,24 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
} }
} }
private void destroyLinphoneCore() {
if (LinphonePreferences.instance() != null) {
// We set network reachable at false before destroy LC to not send register with expires at 0
if (LinphonePreferences.instance().isPushNotificationEnabled()
|| LinphonePreferences.instance().isBackgroundModeEnabled()) {
mLc.setNetworkReachable(false);
}
}
mLc = null;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void doDestroy() { private void doDestroy() {
ContactsManagerDestroy(); ContactsManagerDestroy();
BluetoothManagerDestroy(); BluetoothManagerDestroy();
try { try {
mTimer.cancel(); mTimer.cancel();
mLc = null; destroyLinphoneCore();
} }
catch (RuntimeException e) { catch (RuntimeException e) {
Log.e(e); Log.e(e);
@ -947,7 +958,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);
} }
mLc = null;
instance = null; instance = null;
} }
} }