2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 06:05:12 +00:00

[Reveivenotification] Put notifications into own channel

Summary:
This allows for more fine-grained control.
CCBUG: 402488

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17787
This commit is contained in:
Nicolas Fella
2018-12-24 23:14:44 +01:00
parent 54b2a20b3a
commit f294d763eb
3 changed files with 9 additions and 1 deletions

View File

@@ -323,5 +323,6 @@
<string name="new_notification">New notification</string>
<string name="block_contents">Block contents of notifications</string>
<string name="block_images">Block images in notifications</string>
<string name="notification_channel_receivenotification">Notifications from other devices</string>
</resources>

View File

@@ -17,6 +17,7 @@ public class NotificationHelper {
public final static String DEFAULT = "default";
public final static String MEDIA_CONTROL = "media_control";
public final static String FILETRANSFER = "filetransfer";
public final static String RECEIVENOTIFICATION = "receive";
}
public static void notifyCompat(NotificationManager notificationManager, int notificationId, Notification notification) {
@@ -73,6 +74,12 @@ public class NotificationHelper {
manager.createNotificationChannel(fileTransfer);
manager.createNotificationChannel(new NotificationChannel(
Channels.RECEIVENOTIFICATION,
context.getString(R.string.notification_channel_receivenotification),
NotificationManager.IMPORTANCE_DEFAULT)
);
}

View File

@@ -105,7 +105,7 @@ public class ReceiveNotificationsPlugin extends Plugin {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification noti = new NotificationCompat.Builder(context, NotificationHelper.Channels.DEFAULT)
Notification noti = new NotificationCompat.Builder(context, NotificationHelper.Channels.RECEIVENOTIFICATION)
.setContentTitle(np.getString("appName"))
.setContentText(np.getString("ticker"))
.setContentIntent(resultPendingIntent)