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 e3a1aa8694131e4822cacea6ef23622052b72669..ea5b83a9ae623e2cbdf2acca3d941e2724ab1996 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 @@ -3128,9 +3128,9 @@ public class ConferenceSDKModule extends BaseSDKModule { conferenceSDKListener.onConferenceConnected(mActiveConference); startTimer(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - getContext().startForegroundService(ConferenceService.getStartIntent(getContext(), true)); + getContext().startForegroundService(ConferenceService.getStartIntent(getContext())); } else { - getContext().startService(ConferenceService.getStartIntent(getContext(), true)); + getContext().startService(ConferenceService.getStartIntent(getContext())); } if (enterWaitingRoom) { onConferenceMembersSucceedResponse("", callId, true); 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 67abe8e9b6d442d485e9c4b806629495b0ac5f01..3eb8178a7724c01d911f91dd2ca7e7c02e595f9a 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 @@ -61,24 +61,10 @@ public class ConferenceService extends Service implements SensorEventListener { public static Intent getStartIntent(Context context) { Intent startIntent = new Intent(context, ConferenceService.class); startIntent.setAction(START_CONFERENCE_FOREGROUND_ACTION); + startIntent.putExtra(START_CONFERENCE_WAKE_LOCK_ACTION, true); return startIntent; } - public static Intent getStartIntent(Context context, boolean withWakeLock) { - Intent startIntent = new Intent(context, ConferenceService.class); - startIntent.setAction(START_CONFERENCE_FOREGROUND_ACTION); - if (withWakeLock) { - startIntent.putExtra(START_CONFERENCE_WAKE_LOCK_ACTION, withWakeLock); - } - return startIntent; - } - - public static Intent getStartWakeLockIntent(Context context) { - Intent startWLIntent = new Intent(context, ConferenceService.class); - startWLIntent.setAction(START_CONFERENCE_WAKE_LOCK_ACTION); - return startWLIntent; - } - public static Intent getStopIntent(Context context) { Intent stopIntent = new Intent(context, ConferenceService.class); stopIntent.setAction(STOP_CONFERENCE_FOREGROUND_ACTION); @@ -92,11 +78,7 @@ public class ConferenceService extends Service implements SensorEventListener { @Override public int onStartCommand(@Nullable Intent intent, int flags, int startId) { if (intent != null && START_CONFERENCE_FOREGROUND_ACTION.equalsIgnoreCase(intent.getAction())) { - 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 && START_CONFERENCE_WAKE_LOCK_ACTION.equalsIgnoreCase(intent.getAction())) { - tryStartyWakeLock(); + startForeground(intent.getAction()); } return START_NOT_STICKY; } @@ -128,11 +110,11 @@ public class ConferenceService extends Service implements SensorEventListener { } catch (Exception e) { Timber.e(e); } - startForeground(START_CONFERENCE_FOREGROUND_ACTION, true); + startForeground(START_CONFERENCE_FOREGROUND_ACTION); } @Synchronized - private void startForeground(@Nullable String action, boolean tryWakeLock) { + private void startForeground(@Nullable String action) { if (action != null && START_CONFERENCE_FOREGROUND_ACTION.equalsIgnoreCase(action) && !mForegroundStarted) { final String anotherUsername = mDataManager.getConferenceSDK().getAnotherUsername(); @@ -160,9 +142,7 @@ public class ConferenceService extends Service implements SensorEventListener { mForegroundStarted = true; mNotificationHelper.clearCallPush(ActiveConferenceCall.ANDROID_10_PUSH_CALL_NTFN_ID); - if (tryWakeLock) { - tryStartyWakeLock(); - } + tryStartyWakeLock(); } } diff --git a/app/src/main/java/com/nynja/mobile/communicator/ui/activities/MainActivity.java b/app/src/main/java/com/nynja/mobile/communicator/ui/activities/MainActivity.java index d3ec2a1c170d69e573b0ffc25313171dccef8c2c..67ad0d61ebe51e40901b69405a35c4c023dc5c0b 100644 --- a/app/src/main/java/com/nynja/mobile/communicator/ui/activities/MainActivity.java +++ b/app/src/main/java/com/nynja/mobile/communicator/ui/activities/MainActivity.java @@ -694,7 +694,7 @@ public class MainActivity extends BaseActivity implements MainActivityView, @Override public void stopActiveCallNotification() { - startService(ConferenceService.getStopIntent(this)); + stopService(ConferenceService.getStopIntent(this)); Toast.makeText(this, R.string.call_not_found, Toast.LENGTH_SHORT).show(); }