Hi,
We are making an app with ionic 3 that gives some reminders to users.So we use local notifications
https://ionicframework.com/docs/native/local-notifications/ plugin from ionic native.We also included sound for the reminder. The plugin works fine when the app is running.But when i closed the app or killed i didnt receive any notifications that i scheduled . I did spent more time on searching about this issue.Many persons faced this.But there is no proper fix for this bug. Anyone know about fix for this or please suggest me any other ionic plugin for reminder. Note:It should give notifications even when app is killed.
Is this documented anywhere?
Please provide links to issues on the actual Cordova plugin Github that mention this problem: Issues · katzer/cordova-plugin-local-notifications · GitHub
Is this on iOS or android? Are these repeating reminders or single? What OS versions have you tested on?
Beyond those major questions that you need to figure out, I’d also recommending trying to use the Telerik fork of the notification plugin and see if your code works: https://github.com/Telerik-Verified-Plugins/LocalNotification
And yes it should work even if your app is not running. Once you register the notification with the OS, the OS makes the notification appear, doesn’t matter what your app is doing.
@rlouie Your given Github link not supported for the IONIC application. Do you have any alternate for the same? @IonicGeoff Do you have any idea?
I can’t give you a solution right now, but I’ve also used this Plugin in one of my apps and there was now problem with notifications when the app was closed or killed. I can confirm that the notifications have continued to work. I remember sending a notification every minute telling me my current position using background geolocation.
Tipp: Capacitor provides a API for Push Notifications without using an external plugin
I guess you need to verify if the notification was registered in the first place?
Have you tried any of the methods available to check this?
Hi,
You have to create a Background Service, this can help you https://github.com/Red-Folder/bgs-core/wiki/Build-your-own-Background-Service
I am also facing the same issue, after scheduling the local notifications in my app and killing the app, the notifications are not firing in my phone on the time scheduled. I searched for some solution for couple of months but with no luck.
But recently when my colleague was working with the local notifications in another app and tried on his phone, they were working fine. It was very strange to know that the same plugin is working on his device and not on my device, even though the plugin version and the Android version were same on both the devices (Android 9). Being curious, we tested on few other devices and we found that the notifications were firing on the devices having base android/Android One and not on the devices having custom OS viz MIUI, Funtouch OS, Color OS, Oxygen OS.
Following are devices we tested that are having base android/Android One on which notifications were firing properly:-
Nokia 6.1
Samsung Galaxy A5
Moto G5S Plus
MI A2
Following are devices we tested that are having custom OS and on which notifications did not fire:-
Oneplus 7 Pro (Oxygen OS)
Vivo V11 Pro (Funtouch OS)
Oppo F9 (Color OS)
Redmi Note 4 (MIUI)
So I think this might not be the issue with the plugin itself but with the custom android OS.
My ionic info:-
Ionic:
ionic (Ionic CLI) : 4.12.0 (/Users/Hybrid/.nvm/versions/node/v10.15.1/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.4.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.3.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 5.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 19 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/Hybrid/Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v10.15.1 (/Users/Hybrid/.nvm/versions/node/v10.15.1/bin/node)
npm : 6.4.1
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
have u found any solution regarding this ? bcoz in my case the app even crashes if i dont dont use
this.backgroundMode.setDefaults({ silent: true });
on android 9 and above.
For anyone who may still have this issue, it could be the Battery Optimisation feature on some Android devices. Try turn that off for your app from the settings and see if that works. If it does maybe form an alert to advise your users that they may need to turn it off for the app in order for the local notifications to work.