From b56c559aaa7e6edb495d15b19e8fbc314fb22515 Mon Sep 17 00:00:00 2001 From: DoktorAerzt Date: Thu, 12 Jul 2018 09:08:58 +0200 Subject: [PATCH 01/11] Added ScheduledJobHandler.cs And make use of it when the Device is newer or is Lollipop --- .../LocalNotificationsImplementation.cs | 71 ++++++++++++++++--- .../Plugin.LocalNotifications.Android.csproj | 5 +- .../Resources/Resource.Designer.cs | 8 +-- .../ScheduledJobHandler.cs | 51 +++++++++++++ 4 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index 4477ddc..c5ff10e 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -6,6 +6,7 @@ using System.IO; using System.Xml.Serialization; using Android.OS; +using Android.App.Job; namespace Plugin.LocalNotifications { @@ -97,13 +98,53 @@ public void Show(string title, string body, int id, DateTime notifyTime) } var serializedNotification = SerializeNotification(localNotification); - intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); - - var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); var triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); - var alarmManager = GetAlarmManager(); - alarmManager.Set(AlarmType.RtcWakeup, triggerTime, pendingIntent); + if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) + { + Java.Lang.Class javaClass = Java.Lang.Class.FromType(typeof(ScheduledJobHandler)); + ComponentName component = new ComponentName(Application.Context, javaClass); + + // Bundle up parameters + var extras = new PersistableBundle(); + extras.PutString(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); + + JobInfo.Builder builder = new JobInfo.Builder(id, component) + .SetMinimumLatency(triggerTime) // Fire at TriggerTime + .SetOverrideDeadline(triggerTime + 5000) // Or at least 5 Seconds Later + .SetExtras(extras) + .SetPersisted(true); //Job will be recreated after Reboot + JobInfo jobInfo = builder.Build(); + + JobScheduler jobScheduler = (JobScheduler)Application.Context.GetSystemService("JobSchedulerService"); + int result = jobScheduler.Schedule(jobInfo); + if (result == JobScheduler.ResultSuccess) + { + // The job was scheduled. So nothing more to do + } + else + { + // The job wasn´t scheduled. So just use the old implementation? + + intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); + + var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); + + var alarmManager = GetAlarmManager(); + + alarmManager.Set(AlarmType.RtcWakeup, triggerTime, pendingIntent); + } + } + else + { + intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); + + var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); + + var alarmManager = GetAlarmManager(); + + alarmManager.Set(AlarmType.RtcWakeup, triggerTime, pendingIntent); + } } /// @@ -112,14 +153,22 @@ public void Show(string title, string body, int id, DateTime notifyTime) /// Id of the notification to cancel public void Cancel(int id) { - var intent = CreateIntent(id); - var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); + if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) + { + JobScheduler jobScheduler = (JobScheduler)Application.Context.GetSystemService("JobSchedulerService"); + jobScheduler.Cancel(id); + } + else + { + var intent = CreateIntent(id); + var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); - var alarmManager = GetAlarmManager(); - alarmManager.Cancel(pendingIntent); + var alarmManager = GetAlarmManager(); + alarmManager.Cancel(pendingIntent); - var notificationManager = NotificationManagerCompat.From(Application.Context); - notificationManager.Cancel(id); + var notificationManager = NotificationManagerCompat.From(Application.Context); + notificationManager.Cancel(id); + } } private Intent CreateIntent(int id) diff --git a/src/Plugin.LocalNotifications.Android/Plugin.LocalNotifications.Android.csproj b/src/Plugin.LocalNotifications.Android/Plugin.LocalNotifications.Android.csproj index 322f099..94d02e5 100644 --- a/src/Plugin.LocalNotifications.Android/Plugin.LocalNotifications.Android.csproj +++ b/src/Plugin.LocalNotifications.Android/Plugin.LocalNotifications.Android.csproj @@ -14,9 +14,9 @@ 512 Resources\Resource.Designer.cs Off - true v8.1 - + + true @@ -57,6 +57,7 @@ + diff --git a/src/Plugin.LocalNotifications.Android/Resources/Resource.Designer.cs b/src/Plugin.LocalNotifications.Android/Resources/Resource.Designer.cs index 04f3fd5..5389127 100644 --- a/src/Plugin.LocalNotifications.Android/Resources/Resource.Designer.cs +++ b/src/Plugin.LocalNotifications.Android/Resources/Resource.Designer.cs @@ -1,11 +1,11 @@ #pragma warning disable 1591 //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. // //------------------------------------------------------------------------------ diff --git a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs new file mode 100644 index 0000000..adb266f --- /dev/null +++ b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs @@ -0,0 +1,51 @@ +using System.IO; +using System.Xml.Serialization; + +using Android.App; +using Android.App.Job; + +namespace Plugin.LocalNotifications +{ + [Service(Name = "Plugin.LocalNotifications.ScheduledJobHandler", Permission = "android.permission.BIND_JOB_SERVICE")] + public class ScheduledJobHandler : JobService + { + + /// + /// + /// + /// + /// + public override bool OnStartJob(JobParameters jobParams) + { + var extra = jobParams.Extras.GetString(ScheduledAlarmHandler.LocalNotificationKey); + var notification = DeserializeNotification(extra); + + CrossLocalNotifications.Current.Show(notification.Title, notification.Body, notification.Id); + return true; + } + + public override bool OnStopJob(JobParameters jobParams) + { + // Called by Android when it has to terminate a running service. + return false; // Don't reschedule the job. + } + + + private LocalNotification DeserializeNotification(string notificationString) + { + var xmlSerializer = new XmlSerializer(typeof(LocalNotification)); + using (var stringReader = new StringReader(notificationString)) + { + var notification = (LocalNotification)xmlSerializer.Deserialize(stringReader); + return notification; + } + } + + + + + + + + } +} \ No newline at end of file From 160adf2fae51ec3bb287c3ae125fb61bc0153690 Mon Sep 17 00:00:00 2001 From: Michael Bohnet Date: Thu, 12 Jul 2018 15:49:44 +0200 Subject: [PATCH 02/11] Added CheckBootPermission And Fixed 2 Bugs --- src/LocalNotificationsPlugin.sln | 169 +++++++++++++++++- .../LocalNotificationsImplementation.cs | 27 ++- .../ScheduledJobHandler.cs | 11 +- 3 files changed, 189 insertions(+), 18 deletions(-) diff --git a/src/LocalNotificationsPlugin.sln b/src/LocalNotificationsPlugin.sln index 4d1c590..9f81441 100644 --- a/src/LocalNotificationsPlugin.sln +++ b/src/LocalNotificationsPlugin.sln @@ -1,10 +1,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.27906.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.Abstractions", "Plugin.LocalNotifications.Abstractions\Plugin.LocalNotifications.Abstractions.csproj", "{57564CE6-C079-47C5-9272-4395A0224C3D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.LocalNotifications.Abstractions", "Plugin.LocalNotifications.Abstractions\Plugin.LocalNotifications.Abstractions.csproj", "{57564CE6-C079-47C5-9272-4395A0224C3D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications", "Plugin.LocalNotifications\Plugin.LocalNotifications.csproj", "{0B4E7C6B-EFB6-480B-88C9-B8680DB6B5CD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.LocalNotifications", "Plugin.LocalNotifications\Plugin.LocalNotifications.csproj", "{0B4E7C6B-EFB6-480B-88C9-B8680DB6B5CD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.Android", "Plugin.LocalNotifications.Android\Plugin.LocalNotifications.Android.csproj", "{D446C57C-1E30-4AE2-ADA2-083DC4D0341A}" EndProject @@ -14,6 +14,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.U EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.macOS", "Plugin.LocalNotifications.macOS\Plugin.LocalNotifications.macOS.csproj", "{1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample.Android", "sample\sample.Android\sample.Android.csproj", "{0E4AC3D0-E514-4599-B963-83A97E2C2AE0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample.iOS", "sample\sample.iOS\sample.iOS.csproj", "{B586AB11-8885-4B1B-A28B-A6E8FDF36B10}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample", "sample\sample\sample.csproj", "{F15F3B54-1314-4A4F-96E9-7649C12D83F5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -315,8 +321,163 @@ Global {1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}.Release|x64.Build.0 = Release|Any CPU {1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}.Release|x86.ActiveCfg = Release|Any CPU {1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}.Release|x86.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|ARM.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|ARM.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x64.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x64.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x86.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x86.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|Any CPU.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|Any CPU.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|ARM.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|ARM.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|ARM.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhone.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhone.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x64.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x64.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x64.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x86.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x86.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x86.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|ARM.ActiveCfg = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|ARM.Build.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|ARM.Deploy.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhone.Build.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhone.Deploy.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x64.ActiveCfg = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x64.Build.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x64.Deploy.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x86.ActiveCfg = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x86.Build.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x86.Deploy.0 = Debug|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|Any CPU.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|Any CPU.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|ARM.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|ARM.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|ARM.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhone.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhone.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhone.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x64.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x64.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x64.Deploy.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x86.ActiveCfg = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x86.Build.0 = Release|Any CPU + {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x86.Deploy.0 = Release|Any CPU + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|ARM.ActiveCfg = AppStore|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhone.ActiveCfg = AppStore|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhone.Build.0 = AppStore|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|x64.ActiveCfg = AppStore|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|x86.ActiveCfg = AppStore|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|Any CPU.ActiveCfg = Debug|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|ARM.ActiveCfg = Debug|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhone.ActiveCfg = Debug|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhone.Build.0 = Debug|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|x64.ActiveCfg = Debug|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|x86.ActiveCfg = Debug|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|Any CPU.ActiveCfg = Release|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|ARM.ActiveCfg = Release|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhone.ActiveCfg = Release|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhone.Build.0 = Release|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|x64.ActiveCfg = Release|iPhone + {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|x86.ActiveCfg = Release|iPhone + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x64.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x86.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|Any CPU.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|ARM.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|ARM.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhone.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x64.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x64.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x86.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x86.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|ARM.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|ARM.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhone.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x64.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x64.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x86.ActiveCfg = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x86.Build.0 = Debug|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|Any CPU.Build.0 = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|ARM.ActiveCfg = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|ARM.Build.0 = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhone.ActiveCfg = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhone.Build.0 = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x64.ActiveCfg = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x64.Build.0 = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x86.ActiveCfg = Release|Any CPU + {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E1FE8C60-EFF5-4C3D-89F4-62A29FC06AB6} + EndGlobalSection EndGlobal diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index c5ff10e..77864ba 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -98,7 +98,9 @@ public void Show(string title, string body, int id, DateTime notifyTime) } var serializedNotification = SerializeNotification(localNotification); - var triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); + + + if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { @@ -109,15 +111,19 @@ public void Show(string title, string body, int id, DateTime notifyTime) var extras = new PersistableBundle(); extras.PutString(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); + var triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime) - NotifyTimeInMilliseconds(DateTime.Now); + JobInfo.Builder builder = new JobInfo.Builder(id, component) .SetMinimumLatency(triggerTime) // Fire at TriggerTime .SetOverrideDeadline(triggerTime + 5000) // Or at least 5 Seconds Later .SetExtras(extras) - .SetPersisted(true); //Job will be recreated after Reboot + .SetPersisted(CheckBootPermission()); //Job will be recreated after Reboot if Permissions are granted JobInfo jobInfo = builder.Build(); - JobScheduler jobScheduler = (JobScheduler)Application.Context.GetSystemService("JobSchedulerService"); + JobScheduler jobScheduler = GetJobScheduler(); + int result = jobScheduler.Schedule(jobInfo); + if (result == JobScheduler.ResultSuccess) { // The job was scheduled. So nothing more to do @@ -125,7 +131,7 @@ public void Show(string title, string body, int id, DateTime notifyTime) else { // The job wasn´t scheduled. So just use the old implementation? - + triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); @@ -142,7 +148,7 @@ public void Show(string title, string body, int id, DateTime notifyTime) var pendingIntent = PendingIntent.GetBroadcast(Application.Context, 0, intent, PendingIntentFlags.CancelCurrent); var alarmManager = GetAlarmManager(); - + var triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); alarmManager.Set(AlarmType.RtcWakeup, triggerTime, pendingIntent); } } @@ -184,6 +190,17 @@ private AlarmManager GetAlarmManager() return alarmManager; } + private JobScheduler GetJobScheduler() + { + var jobScheduler = Application.Context.GetSystemService(Context.JobSchedulerService) as JobScheduler; + return jobScheduler; + } + + private bool CheckBootPermission() + { + return Application.Context.CheckSelfPermission("RECEIVE_BOOT_COMPLETED") == Android.Content.PM.Permission.Granted; + } + private string SerializeNotification(LocalNotification notification) { var xmlSerializer = new XmlSerializer(notification.GetType()); diff --git a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs index adb266f..ac59094 100644 --- a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs +++ b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs @@ -9,6 +9,7 @@ namespace Plugin.LocalNotifications [Service(Name = "Plugin.LocalNotifications.ScheduledJobHandler", Permission = "android.permission.BIND_JOB_SERVICE")] public class ScheduledJobHandler : JobService { + string _packageName => Application.Context.PackageName; /// /// @@ -30,7 +31,6 @@ public override bool OnStopJob(JobParameters jobParams) return false; // Don't reschedule the job. } - private LocalNotification DeserializeNotification(string notificationString) { var xmlSerializer = new XmlSerializer(typeof(LocalNotification)); @@ -39,13 +39,6 @@ private LocalNotification DeserializeNotification(string notificationString) var notification = (LocalNotification)xmlSerializer.Deserialize(stringReader); return notification; } - } - - - - - - - + } } } \ No newline at end of file From 893f9cbce66cdab9e9fd6af915aa0c0e211f80d4 Mon Sep 17 00:00:00 2001 From: Michael Bohnet Date: Thu, 12 Jul 2018 15:53:53 +0200 Subject: [PATCH 03/11] Removed Sample Project Removed useless Variable --- src/LocalNotificationsPlugin.sln | 158 ------------------ .../ScheduledJobHandler.cs | 1 - 2 files changed, 159 deletions(-) diff --git a/src/LocalNotificationsPlugin.sln b/src/LocalNotificationsPlugin.sln index 9f81441..e3cb4d9 100644 --- a/src/LocalNotificationsPlugin.sln +++ b/src/LocalNotificationsPlugin.sln @@ -14,12 +14,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.U EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.macOS", "Plugin.LocalNotifications.macOS\Plugin.LocalNotifications.macOS.csproj", "{1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample.Android", "sample\sample.Android\sample.Android.csproj", "{0E4AC3D0-E514-4599-B963-83A97E2C2AE0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample.iOS", "sample\sample.iOS\sample.iOS.csproj", "{B586AB11-8885-4B1B-A28B-A6E8FDF36B10}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample", "sample\sample\sample.csproj", "{F15F3B54-1314-4A4F-96E9-7649C12D83F5}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Ad-Hoc|Any CPU = Ad-Hoc|Any CPU @@ -321,158 +315,6 @@ Global {1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}.Release|x64.Build.0 = Release|Any CPU {1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}.Release|x86.ActiveCfg = Release|Any CPU {1F3C7F03-BCEB-46E7-B9B8-843D4DEF7364}.Release|x86.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|ARM.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|ARM.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x64.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x64.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x86.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Ad-Hoc|x86.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|Any CPU.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|Any CPU.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|ARM.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|ARM.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|ARM.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhone.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhone.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x64.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x64.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x64.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x86.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x86.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.AppStore|x86.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|ARM.ActiveCfg = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|ARM.Build.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|ARM.Deploy.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhone.Build.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhone.Deploy.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x64.ActiveCfg = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x64.Build.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x64.Deploy.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x86.ActiveCfg = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x86.Build.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Debug|x86.Deploy.0 = Debug|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|Any CPU.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|Any CPU.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|ARM.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|ARM.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|ARM.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhone.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhone.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhone.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x64.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x64.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x64.Deploy.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x86.ActiveCfg = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x86.Build.0 = Release|Any CPU - {0E4AC3D0-E514-4599-B963-83A97E2C2AE0}.Release|x86.Deploy.0 = Release|Any CPU - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|x64.ActiveCfg = Ad-Hoc|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|ARM.ActiveCfg = AppStore|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhone.ActiveCfg = AppStore|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhone.Build.0 = AppStore|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|x64.ActiveCfg = AppStore|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.AppStore|x86.ActiveCfg = AppStore|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|Any CPU.ActiveCfg = Debug|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|ARM.ActiveCfg = Debug|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhone.ActiveCfg = Debug|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhone.Build.0 = Debug|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|x64.ActiveCfg = Debug|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Debug|x86.ActiveCfg = Debug|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|Any CPU.ActiveCfg = Release|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|ARM.ActiveCfg = Release|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhone.ActiveCfg = Release|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhone.Build.0 = Release|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|x64.ActiveCfg = Release|iPhone - {B586AB11-8885-4B1B-A28B-A6E8FDF36B10}.Release|x86.ActiveCfg = Release|iPhone - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|ARM.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhone.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x64.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x64.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x86.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.AppStore|x86.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|ARM.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhone.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x64.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x64.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x86.ActiveCfg = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Debug|x86.Build.0 = Debug|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|Any CPU.Build.0 = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|ARM.ActiveCfg = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|ARM.Build.0 = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhone.ActiveCfg = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhone.Build.0 = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x64.ActiveCfg = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x64.Build.0 = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x86.ActiveCfg = Release|Any CPU - {F15F3B54-1314-4A4F-96E9-7649C12D83F5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs index ac59094..45464ef 100644 --- a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs +++ b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs @@ -9,7 +9,6 @@ namespace Plugin.LocalNotifications [Service(Name = "Plugin.LocalNotifications.ScheduledJobHandler", Permission = "android.permission.BIND_JOB_SERVICE")] public class ScheduledJobHandler : JobService { - string _packageName => Application.Context.PackageName; /// /// From dd4cbf89e831530d172acb2bb060577f8a5c37fe Mon Sep 17 00:00:00 2001 From: DoktorAerzt Date: Fri, 13 Jul 2018 09:20:21 +0200 Subject: [PATCH 04/11] Fixed Cancel Get the Correct JobScheduler --- .../LocalNotificationsImplementation.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index 77864ba..d905091 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -130,7 +130,7 @@ public void Show(string title, string body, int id, DateTime notifyTime) } else { - // The job wasn´t scheduled. So just use the old implementation? + // The job wasn´t scheduled. So just use the old implementation? triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); @@ -161,7 +161,7 @@ public void Cancel(int id) { if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { - JobScheduler jobScheduler = (JobScheduler)Application.Context.GetSystemService("JobSchedulerService"); + JobScheduler jobScheduler = GetJobScheduler(); jobScheduler.Cancel(id); } else @@ -220,4 +220,4 @@ private long NotifyTimeInMilliseconds(DateTime notifyTime) return utcAlarmTimeInMillis; } } -} \ No newline at end of file +} From a6232ff87bc214ee6b279f15ac9bb9f89cae0d23 Mon Sep 17 00:00:00 2001 From: Michael Bohnet Date: Tue, 17 Jul 2018 06:50:01 +0200 Subject: [PATCH 05/11] Added LocalNotificationIconId to safe the Icon with the job --- .../LocalNotificationsImplementation.cs | 5 +++-- .../ScheduledJobHandler.cs | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index d905091..bafd0d3 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -110,6 +110,7 @@ public void Show(string title, string body, int id, DateTime notifyTime) // Bundle up parameters var extras = new PersistableBundle(); extras.PutString(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); + extras.PutInt(ScheduledJobHandler.LocalNotificationIconId, NotificationIconId); var triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime) - NotifyTimeInMilliseconds(DateTime.Now); @@ -130,7 +131,7 @@ public void Show(string title, string body, int id, DateTime notifyTime) } else { - // The job wasn´t scheduled. So just use the old implementation? + // The job wasn´t scheduled. So just use the old implementation? triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); @@ -220,4 +221,4 @@ private long NotifyTimeInMilliseconds(DateTime notifyTime) return utcAlarmTimeInMillis; } } -} +} \ No newline at end of file diff --git a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs index 45464ef..5865f82 100644 --- a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs +++ b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs @@ -9,6 +9,10 @@ namespace Plugin.LocalNotifications [Service(Name = "Plugin.LocalNotifications.ScheduledJobHandler", Permission = "android.permission.BIND_JOB_SERVICE")] public class ScheduledJobHandler : JobService { + /// + /// + /// + public const string LocalNotificationIconId = "LocalNotificationIconId"; /// /// @@ -18,8 +22,10 @@ public class ScheduledJobHandler : JobService public override bool OnStartJob(JobParameters jobParams) { var extra = jobParams.Extras.GetString(ScheduledAlarmHandler.LocalNotificationKey); + var NotificationIconId = jobParams.Extras.GetInt(LocalNotificationIconId); var notification = DeserializeNotification(extra); + LocalNotificationsImplementation.NotificationIconId = NotificationIconId; CrossLocalNotifications.Current.Show(notification.Title, notification.Body, notification.Id); return true; } From 80baa6285f7b123f81104f4b9c945f845538faff Mon Sep 17 00:00:00 2001 From: DoktorAerzt Date: Wed, 25 Jul 2018 07:13:04 +0200 Subject: [PATCH 06/11] Changed Job Name to lowercase Changed Job Name to lowercase to try to fix the manifest error --- src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs index 5865f82..c65d2eb 100644 --- a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs +++ b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs @@ -6,7 +6,7 @@ namespace Plugin.LocalNotifications { - [Service(Name = "Plugin.LocalNotifications.ScheduledJobHandler", Permission = "android.permission.BIND_JOB_SERVICE")] + [Service(Name = "plugin.localnotifications.ScheduledJobHandler", Permission = "android.permission.BIND_JOB_SERVICE")] public class ScheduledJobHandler : JobService { /// @@ -46,4 +46,4 @@ private LocalNotification DeserializeNotification(string notificationString) } } } -} \ No newline at end of file +} From 2ba23b9a23b7fe10cc1fa547966b156a7a1950fa Mon Sep 17 00:00:00 2001 From: DoktorAerzt Date: Wed, 29 Aug 2018 14:29:27 +0200 Subject: [PATCH 07/11] Fixed Permission The Permission aren't called RECEIVE_BOOT_COMPLETED they are called android.permission.RECEIVE_BOOT_COMPLETED --- .../LocalNotificationsImplementation.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index bafd0d3..8f1fdbf 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -131,7 +131,7 @@ public void Show(string title, string body, int id, DateTime notifyTime) } else { - // The job wasn´t scheduled. So just use the old implementation? + // The job wasn´t scheduled. So just use the old implementation? triggerTime = NotifyTimeInMilliseconds(localNotification.NotifyTime); intent.PutExtra(ScheduledAlarmHandler.LocalNotificationKey, serializedNotification); @@ -199,7 +199,7 @@ private JobScheduler GetJobScheduler() private bool CheckBootPermission() { - return Application.Context.CheckSelfPermission("RECEIVE_BOOT_COMPLETED") == Android.Content.PM.Permission.Granted; + return Application.Context.CheckSelfPermission("android.permission.RECEIVE_BOOT_COMPLETED") == Android.Content.PM.Permission.Granted; } private string SerializeNotification(LocalNotification notification) @@ -221,4 +221,4 @@ private long NotifyTimeInMilliseconds(DateTime notifyTime) return utcAlarmTimeInMillis; } } -} \ No newline at end of file +} From e41e521a02d11dfe356d78b624865a62c325b930 Mon Sep 17 00:00:00 2001 From: DoktorAerzt Date: Thu, 7 Mar 2019 09:20:20 +0100 Subject: [PATCH 08/11] Update LocalNotificationsImplementation.cs Added a check for the Version in CheckBootPermission and use PermissionChecker if the Version is not Marshmallow or higher --- .../LocalNotificationsImplementation.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs index 8f1fdbf..3ae99b8 100644 --- a/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs +++ b/src/Plugin.LocalNotifications.Android/LocalNotificationsImplementation.cs @@ -199,7 +199,14 @@ private JobScheduler GetJobScheduler() private bool CheckBootPermission() { - return Application.Context.CheckSelfPermission("android.permission.RECEIVE_BOOT_COMPLETED") == Android.Content.PM.Permission.Granted; + if (Build.VERSION.SdkInt >= BuildVersionCodes.M) + { + return Application.Context.CheckSelfPermission("android.permission.RECEIVE_BOOT_COMPLETED") == Android.Content.PM.Permission.Granted; + } + else + { + return Android.Support.V4.Content.PermissionChecker.CheckSelfPermission(Application.Context, "android.permission.RECEIVE_BOOT_COMPLETED") == Android.Support.V4.Content.PermissionChecker.PermissionGranted; + } } private string SerializeNotification(LocalNotification notification) From e7498402b0825632639fa0b426b074d5cf8f333f Mon Sep 17 00:00:00 2001 From: Michael Bohnet Date: Wed, 17 Apr 2019 14:16:51 +0200 Subject: [PATCH 09/11] Changed Variable Name to camelCase --- src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs index c65d2eb..ead7ea3 100644 --- a/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs +++ b/src/Plugin.LocalNotifications.Android/ScheduledJobHandler.cs @@ -22,10 +22,10 @@ public class ScheduledJobHandler : JobService public override bool OnStartJob(JobParameters jobParams) { var extra = jobParams.Extras.GetString(ScheduledAlarmHandler.LocalNotificationKey); - var NotificationIconId = jobParams.Extras.GetInt(LocalNotificationIconId); + var notificationIconId = jobParams.Extras.GetInt(LocalNotificationIconId); var notification = DeserializeNotification(extra); - LocalNotificationsImplementation.NotificationIconId = NotificationIconId; + LocalNotificationsImplementation.NotificationIconId = notificationIconId; CrossLocalNotifications.Current.Show(notification.Title, notification.Body, notification.Id); return true; } From 33f3acf4a31add17337071e05fc81d1646c95b15 Mon Sep 17 00:00:00 2001 From: Michael Bohnet Date: Wed, 17 Apr 2019 14:18:13 +0200 Subject: [PATCH 10/11] Removed .sln changes --- src/LocalNotificationsPlugin.sln | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/LocalNotificationsPlugin.sln b/src/LocalNotificationsPlugin.sln index e3cb4d9..4df8eb4 100644 --- a/src/LocalNotificationsPlugin.sln +++ b/src/LocalNotificationsPlugin.sln @@ -319,7 +319,4 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E1FE8C60-EFF5-4C3D-89F4-62A29FC06AB6} - EndGlobalSection EndGlobal From 0421c04f5a945f2633568e2452ce84b3fde044e0 Mon Sep 17 00:00:00 2001 From: Michael Bohnet Date: Wed, 17 Apr 2019 15:20:26 +0200 Subject: [PATCH 11/11] Reset my LocalNotificationsPlugin.sln --- src/LocalNotificationsPlugin.sln | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LocalNotificationsPlugin.sln b/src/LocalNotificationsPlugin.sln index 4df8eb4..4d1c590 100644 --- a/src/LocalNotificationsPlugin.sln +++ b/src/LocalNotificationsPlugin.sln @@ -1,10 +1,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27906.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.LocalNotifications.Abstractions", "Plugin.LocalNotifications.Abstractions\Plugin.LocalNotifications.Abstractions.csproj", "{57564CE6-C079-47C5-9272-4395A0224C3D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.Abstractions", "Plugin.LocalNotifications.Abstractions\Plugin.LocalNotifications.Abstractions.csproj", "{57564CE6-C079-47C5-9272-4395A0224C3D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.LocalNotifications", "Plugin.LocalNotifications\Plugin.LocalNotifications.csproj", "{0B4E7C6B-EFB6-480B-88C9-B8680DB6B5CD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications", "Plugin.LocalNotifications\Plugin.LocalNotifications.csproj", "{0B4E7C6B-EFB6-480B-88C9-B8680DB6B5CD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plugin.LocalNotifications.Android", "Plugin.LocalNotifications.Android\Plugin.LocalNotifications.Android.csproj", "{D446C57C-1E30-4AE2-ADA2-083DC4D0341A}" EndProject