Fix crash when service is getting killed while in background
This commit is contained in:
parent
2eef6369bf
commit
f6c0046ae7
1 changed files with 6 additions and 1 deletions
|
@ -821,7 +821,6 @@ public final class LinphoneService extends Service {
|
|||
|
||||
@Override
|
||||
public synchronized void onDestroy() {
|
||||
|
||||
if (activityCallbacks != null){
|
||||
getApplication().unregisterActivityLifecycleCallbacks(activityCallbacks);
|
||||
activityCallbacks = null;
|
||||
|
@ -841,6 +840,12 @@ public final class LinphoneService extends Service {
|
|||
mNM.cancel(INCALL_NOTIF_ID);
|
||||
mNM.cancel(MESSAGE_NOTIF_ID);
|
||||
|
||||
// This will prevent the app from crashing if the service gets killed in background mode
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
Log.w("Service is getting destroyed, finish LinphoneActivity");
|
||||
LinphoneActivity.instance().finish();
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue