Added a ringtone to call notification

This commit is contained in:
Pierre HUBERT 2019-03-02 09:36:37 +01:00
parent 40fce5bef3
commit 039f6d994c
2 changed files with 8 additions and 6 deletions

View File

@ -179,6 +179,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
//Make sure we have access to user camera and microphone //Make sure we have access to user camera and microphone
askForPermissions(); askForPermissions();
//Make the screen keeps on during the call
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} }
@ -186,6 +187,7 @@ public class CallActivity extends BaseActivity implements SignalExchangerCallbac
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
//Allow screen lock
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} }

View File

@ -7,6 +7,7 @@ import android.app.PendingIntent;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.media.RingtoneManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -83,12 +84,9 @@ public class PendingCallsBroadcastReceiver extends BroadcastReceiver {
//Get next pending notification //Get next pending notification
GetNextPendingCallTask task = new GetNextPendingCallTask(context); GetNextPendingCallTask task = new GetNextPendingCallTask(context);
task.setOnPostExecuteListener(new SafeAsyncTask.OnPostExecuteListener<NextPendingCallInformation>() { task.setOnPostExecuteListener(nextPendingCallInformation -> {
@Override
public void OnPostExecute(NextPendingCallInformation nextPendingCallInformation) {
locked = false; locked = false;
onGotCall(context, nextPendingCallInformation); onGotCall(context, nextPendingCallInformation);
}
}); });
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); 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())) .setContentText(UiUtils.getString(context, R.string.notification_call_content, info.getCallName()))
//.setContentIntent(pendingAcceptIntent) //.setContentIntent(pendingAcceptIntent)
.setFullScreenIntent(pendingFullScreenRequestIntent, true) .setFullScreenIntent(pendingFullScreenRequestIntent, true)
.setSound(RingtoneManager.getActualDefaultRingtoneUri(context,
RingtoneManager.TYPE_RINGTONE))
.setPriority(PRIORITY_HIGH); .setPriority(PRIORITY_HIGH);