Local Notification issue

@techsnake

I have found a solution that worked for me it gave me both things I was looking for, a heads up notification and the notifications working when the device is locked and screen is dimmed.

It had one minor drawback in that the device doesnt light up when the notification is received but the sound plays and it works when scheduled. (EDIT: On second look this may be just my phone as it happens with all notifications from any application)

My solution was to uninstall the ionic-native plugin for local notifications and use this fork https://github.com/DavidBriglio/cordova-plugin-local-notifications

Add to your project:


cordova plugin add https://github.com/DavidBriglio/cordova-plugin-local-notifications

Then in the page you’re using local notifications:

Put this up top:
declare var cordova;

then:

this.plt.ready().then(()=> {
         (<any>cordova).plugins.notification.local.schedule({
         id: 1,
         title: "Title",
         text: "Text",
         headsup: true
         at: Date.now()
       });
   });
1 Like