From fc2a924e778b0e3cb56220fee7d9945fe1ec16c3 Mon Sep 17 00:00:00 2001 From: rehmanm Date: Tue, 16 Oct 2018 12:14:19 +0100 Subject: [PATCH 1/3] Updated NotificationImportance LocalNotificationsImplementation.Importance = NotificationImportance.Max; --- .../LocalNotificationsImplementation.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index 4477ddc..0df4a7f 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -21,6 +21,7 @@ public class LocalNotificationsImplementation : ILocalNotifications /// Get or Set Resource Icon to display /// public static int NotificationIconId { get; set; } + public static NotificationImportance Importance { get; set; } = NotificationImportance.Default; /// /// Show a local notification @@ -47,7 +48,8 @@ public void Show(string title, string body, int id = 0) if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { var channelId = $"{_packageName}.general"; - var channel = new NotificationChannel(channelId, "General", NotificationImportance.Default); + //var channel = new NotificationChannel(channelId, "General", NotificationImportance.Default); + var channel = new NotificationChannel(channelId, "General", Importance); _manager.CreateNotificationChannel(channel); From ee5dd1c80501c7972f6b0878536516b37d30f12c Mon Sep 17 00:00:00 2001 From: rehmanm Date: Fri, 19 Oct 2018 20:56:50 +0100 Subject: [PATCH 2/3] Headup Notificaton added Headsup notificaiton for Android 7 and older and Vibration --- .../LocalNotificationsImplementation.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index 0df4a7f..600cb2e 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -22,6 +22,8 @@ public class LocalNotificationsImplementation : ILocalNotifications /// public static int NotificationIconId { get; set; } public static NotificationImportance Importance { get; set; } = NotificationImportance.Default; + public static int Priority { get; set; } = NotificationCompat.PriorityDefault; + public static long[] Vibrate { get; set; } = new long[0]; /// /// Show a local notification @@ -32,9 +34,14 @@ public class LocalNotificationsImplementation : ILocalNotifications public void Show(string title, string body, int id = 0) { var builder = new Notification.Builder(Application.Context); + //var builder = new NotificationCompat.Builder(Application.Context); + builder.SetContentTitle(title); builder.SetContentText(body); builder.SetAutoCancel(true); + builder.SetPriority(Priority); + builder.SetVibrate(Vibrate); + if (NotificationIconId != 0) { From a50b1a42d4db7da479e781922158c60d581b2d73 Mon Sep 17 00:00:00 2001 From: rehmanm Date: Fri, 19 Oct 2018 21:16:46 +0100 Subject: [PATCH 3/3] Set Privacy Visibility Visibility on Phone Lock --- .../LocalNotificationsImplementation.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index 600cb2e..f373444 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -23,7 +23,8 @@ public class LocalNotificationsImplementation : ILocalNotifications public static int NotificationIconId { get; set; } public static NotificationImportance Importance { get; set; } = NotificationImportance.Default; public static int Priority { get; set; } = NotificationCompat.PriorityDefault; - public static long[] Vibrate { get; set; } = new long[0]; + public static long[] Vibrate { get; set; } = new long[0]; + public static NotificationVisibility Visibility { get; set; } = NotificationVisibility.Public; /// /// Show a local notification @@ -41,7 +42,7 @@ public void Show(string title, string body, int id = 0) builder.SetAutoCancel(true); builder.SetPriority(Priority); builder.SetVibrate(Vibrate); - + builder.SetVisibility(Visibility); if (NotificationIconId != 0) {