Set ringtone as sound for one-to-one calls

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2017-12-30 09:23:47 +01:00
parent 67484b544f
commit bf356ca1d8
2 changed files with 8 additions and 6 deletions

View File

@ -29,6 +29,7 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
@ -86,6 +87,7 @@ public class MagicFirebaseMessagingService extends FirebaseMessagingService {
Bitmap largeIcon;
String category = "";
int priority = Notification.PRIORITY_DEFAULT;
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Intent intent = new Intent(this, CallActivity.class);
BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
@ -101,6 +103,7 @@ public class MagicFirebaseMessagingService extends FirebaseMessagingService {
smallIcon = R.drawable.ic_call_black_24dp;
category = Notification.CATEGORY_CALL;
priority = Notification.PRIORITY_HIGH;
soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
break;
case "room":
smallIcon = R.drawable.ic_notifications_black_24dp;
@ -127,14 +130,10 @@ public class MagicFirebaseMessagingService extends FirebaseMessagingService {
.setShowWhen(true)
.setSubText(signatureVerification.getUserEntity().getDisplayName())
.setContentTitle(decryptedPushMessage.getSubject())
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setSound(soundUri)
.setAutoCancel(true);
if (!"call".equals(decryptedPushMessage.getType())) {
notificationBuilder.setContentIntent(pendingIntent);
} else {
notificationBuilder.setFullScreenIntent(pendingIntent, true);
}
notificationBuilder.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

View File

@ -92,4 +92,7 @@
permission in the system settings.</string>
<string name="nc_permissions_settings">Open settings</string>
<!-- Call -->
<string name="nc_incoming_call">Incoming call</string>
</resources>