Wake screen on local notification, and vibrate on local notification


#1

I am looking to wake the screen when a local notification is present, but I have no idea how this would be done. Can anyone point me in the right direction?

I also want to change the vibration on local notification but I can’t seem to find any information on how to do this either. I have tried the vibration plugin by following the docs exactly but I get a ‘no provider’ error every time so I’m wondering if I can avoid using the vibration plugin altogether.

It would make sense for the local notification plugin to be able to change the vibration, so maybe I have missed something.


#2

Anyone resolve this? I’m also can’t wake up phone (not unlock, just turn on backlight) on local notification.


#3

You’re best off using push notifications.

Local notifications won’t let you customise vibration so you would have to try throwing a callback on the notification and use the vibration plug in.

It was a while ago so I can’t remember what was going on with the wake screen stuff.


#4

Of course you can customize the vibration.

  • In your schedule config set { sound: null }
  • Use ionic-native vibration to set your custom vibration

In your notificationProvider constructor set

      // Set vibration ( pattern on Android only )
      this.localNotifications.on('trigger', () => {
         this.vibration.vibrate([100, 200, 400, 200, 100]);
      });