I am using local notification with alarm manager in Xamarin Android, it works fine and when the application was closed notification not displayed.i want to run in background also.
Please help me to resolve this..
Thanks in Advance.
You can try Xam.Plugins.Notifier plugin.
Display a local notification immediately
Display a local notification at a scheduled date/time
CrossLocalNotifications.Current.Show("title", "body", 101, DateTime.Now.AddSeconds(5));
Cancel a local notification
Check the link: https://github.com/edsnider/LocalNotificationsPlugin
@DeepakDeeps Alarm Manager will not work in Android Oreo 8.0 and higher version. You need to use Job Scheduler to achieve your problem.
And if you are running in lower version So, Doze is particularly likely to affect activities that AlarmManager alarms and timers manage, because alarms in Android 5.1 (API level 22) or lower do not fire when the system is in Doze.
To help with scheduling alarms, Android 6.0 (API level 23) introduces two new AlarmManager methods: setAndAllowWhileIdle() and setExactAndAllowWhileIdle(). With these methods, you can set alarms that will fire even if the device is in Doze.
Note: Neither setAndAllowWhileIdle() nor setExactAndAllowWhileIdle() can fire alarms more than once per 9 minutes, per app.
@DeepakDeeps Please refer the below sample. Whenever app is killed it will give the notification.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies