From 039f6d994c36a2d7651d71a2b58a21ba9c24b65a Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 2 Mar 2019 09:36:37 +0100 Subject: [PATCH] Added a ringtone to call notification --- .../comunic/client/ui/activities/CallActivity.java | 2 ++ .../ui/receivers/PendingCallsBroadcastReceiver.java | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java index e1ae35f..a71a654 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/CallActivity.java @@ -179,6 +179,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac //Make sure we have access to user camera and microphone askForPermissions(); + //Make the screen keeps on during the call getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } @@ -186,6 +187,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac protected void onPause() { super.onPause(); + //Allow screen lock getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/receivers/PendingCallsBroadcastReceiver.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/receivers/PendingCallsBroadcastReceiver.java index d6304b5..6a7cc8b 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/receivers/PendingCallsBroadcastReceiver.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/receivers/PendingCallsBroadcastReceiver.java @@ -7,6 +7,7 @@ import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.media.RingtoneManager; import android.os.AsyncTask; import android.os.Build; import android.support.annotation.Nullable; @@ -83,12 +84,9 @@ public class PendingCallsBroadcastReceiver extends BroadcastReceiver { //Get next pending notification GetNextPendingCallTask task = new GetNextPendingCallTask(context); - task.setOnPostExecuteListener(new SafeAsyncTask.OnPostExecuteListener() { - @Override - public void OnPostExecute(NextPendingCallInformation nextPendingCallInformation) { - locked = false; - onGotCall(context, nextPendingCallInformation); - } + task.setOnPostExecuteListener(nextPendingCallInformation -> { + locked = false; + onGotCall(context, nextPendingCallInformation); }); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @@ -129,6 +127,8 @@ public class PendingCallsBroadcastReceiver extends BroadcastReceiver { .setContentText(UiUtils.getString(context, R.string.notification_call_content, info.getCallName())) //.setContentIntent(pendingAcceptIntent) .setFullScreenIntent(pendingFullScreenRequestIntent, true) + .setSound(RingtoneManager.getActualDefaultRingtoneUri(context, + RingtoneManager.TYPE_RINGTONE)) .setPriority(PRIORITY_HIGH);