Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/mumla.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lublin <daniel@lublin.se>2020-03-30 01:43:42 +0300
committerDaniel Lublin <daniel@lublin.se>2020-03-30 01:43:42 +0300
commit4cdd1b5c4b53a868d5d976bf34d6ab2e362d0e6d (patch)
treeea8e77a8d2f5c5658ccc901c5efe500622ed87bd
parent46144278fd3e9ac6630ea0986623eab06d07178a (diff)
Modernize the notification with a channel
-rw-r--r--app/src/main/AndroidManifest.xml1
-rw-r--r--app/src/main/java/com/morlunk/mumbleclient/service/PlumbleConnectionNotification.java18
m---------libraries/Jumble0
3 files changed, 18 insertions, 1 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8e94b25..fad3417 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,6 +23,7 @@
android:name="android.hardware.microphone"
android:required="false" />
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleConnectionNotification.java b/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleConnectionNotification.java
index 9d02719..ae93ed4 100644
--- a/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleConnectionNotification.java
+++ b/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleConnectionNotification.java
@@ -18,14 +18,19 @@
package com.morlunk.mumbleclient.service;
import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.os.Build;
import android.support.v4.app.NotificationCompat;
+import android.util.Log;
+import com.morlunk.mumbleclient.Constants;
import com.morlunk.mumbleclient.R;
import com.morlunk.mumbleclient.app.DrawerAdapter;
import com.morlunk.mumbleclient.app.PlumbleActivity;
@@ -129,11 +134,22 @@ public class PlumbleConnectionNotification {
* Called to update/create the service's foreground Plumble notification.
*/
private Notification createNotification() {
- NotificationCompat.Builder builder = new NotificationCompat.Builder(mService);
+ String channelId = "";
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ channelId = "PlumbleNotificationChannel";
+ String channelName = "Plumble connection";
+ NotificationChannel chan = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT);
+ NotificationManager manager = (NotificationManager) mService.getApplication().getSystemService(Context.NOTIFICATION_SERVICE);
+ manager.createNotificationChannel(chan);
+ }
+ NotificationCompat.Builder builder =
+ new NotificationCompat.Builder(mService.getApplicationContext(), channelId);
+
builder.setContentTitle(mService.getString(R.string.app_name));
builder.setContentText(mCustomContentText);
builder.setSmallIcon(R.drawable.ic_stat_notify);
builder.setPriority(NotificationCompat.PRIORITY_DEFAULT);
+ builder.setCategory(NotificationCompat.CATEGORY_CALL);
builder.setOngoing(true);
if (mActionsShown) {
diff --git a/libraries/Jumble b/libraries/Jumble
-Subproject a8b591de4ac501626a5e19295e7d159636c282a
+Subproject 1fb5b586ce37142e022d32b4d6d68b32bb59aba