diff --git a/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceSDKModule.java b/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceSDKModule.java index b00746dd8364d2bf498f808c26a93411eb64171a..61d8b06193dbf9dc5e7ccb687cdb9fce0af95f03 100644 --- a/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceSDKModule.java +++ b/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceSDKModule.java @@ -414,7 +414,7 @@ public class ConferenceSDKModule extends BaseSDKModule { } private void stopCallService() { - getContext().startService(ConferenceService.getStopIntent(getContext())); + getContext().stopService(ConferenceService.getStopIntent(getContext())); } public void togleFullScreen() { @@ -3212,7 +3212,7 @@ public class ConferenceSDKModule extends BaseSDKModule { conferenceSDKListener.onConferenceFailed(reason); } } - getContext().startService(ConferenceService.getStopIntent(getContext())); + getContext().stopService(ConferenceService.getStopIntent(getContext())); }, Consts.DELAY_50); } diff --git a/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceService.java b/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceService.java index 125887423e6753ef4e038090920e7d9fa4b85778..67abe8e9b6d442d485e9c4b806629495b0ac5f01 100644 --- a/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceService.java +++ b/app/src/main/java/com/nynja/mobile/communicator/data/sdk/calls/ConferenceService.java @@ -95,8 +95,6 @@ public class ConferenceService extends Service implements SensorEventListener { boolean tryWakeLock = (intent.hasExtra(START_CONFERENCE_WAKE_LOCK_ACTION) && intent.getBooleanExtra(START_CONFERENCE_WAKE_LOCK_ACTION, false)); startForeground(intent.getAction(), tryWakeLock); - } else if (intent != null && STOP_CONFERENCE_FOREGROUND_ACTION.equalsIgnoreCase(intent.getAction())) { - stopForeground(STOP_CONFERENCE_FOREGROUND_ACTION); } else if (intent != null && START_CONFERENCE_WAKE_LOCK_ACTION.equalsIgnoreCase(intent.getAction())) { tryStartyWakeLock(); } @@ -168,14 +166,9 @@ public class ConferenceService extends Service implements SensorEventListener { } } - @Synchronized - private void stopForeground(@Nullable String action) { - if (action != null && STOP_CONFERENCE_FOREGROUND_ACTION.equalsIgnoreCase(action)) { - stopForeground(true); - stopSelf(); - mForegroundStarted = false; - mNotificationHelper.clearCallPush(ActiveConferenceCall.ANDROID_10_PUSH_CALL_NTFN_ID); - } + private void clearConferenceCall() { + stopForeground(true); + mNotificationHelper.clearCallPush(ActiveConferenceCall.ANDROID_10_PUSH_CALL_NTFN_ID); } private void safetyProximityWakeLockRelease() { @@ -209,6 +202,9 @@ public class ConferenceService extends Service implements SensorEventListener { @Override public void onDestroy() { Timber.d("onDestroy"); + mForegroundStarted = false; + clearConferenceCall(); + if (!mCommunication.isBinded()) mDataManager.disconnectConference(); if (mProximity != null) {