From d53143ab348e5c1841e6f5008688c258a57df5b5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 27 Nov 2018 10:41:13 +0100 Subject: [PATCH] change audio attributes for notification channel This may help on platforms that make a difference between ringtone volume and notification volume --- .../eu/siacs/conversations/services/NotificationService.java | 2 +- src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index beecad52d..9e713b906 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -145,7 +145,7 @@ public class NotificationService { messagesChannel.setShowBadge(true); messagesChannel.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION), new AudioAttributes.Builder() .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) - .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE) + .setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT) .build()); messagesChannel.setLightColor(LED_COLOR); final int dat = 70; diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 7125eb5b8..bade7e111 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -24,6 +24,7 @@ import android.graphics.Color; import android.graphics.Point; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.media.AudioManager; import android.net.ConnectivityManager; import android.net.Uri; import android.os.AsyncTask; @@ -387,6 +388,7 @@ public abstract class XmppActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setVolumeControlStream(AudioManager.STREAM_NOTIFICATION); metrics = getResources().getDisplayMetrics(); ExceptionHelper.init(getApplicationContext()); this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);