Local Notification help


Hi everyone,

I’m trying to set up local notifications but everywhere a look they are all based on scheduling the notification, my issue is that I dont want to schedule it, I literally just want to push a notification to the user when does something…

for example, they reach a specific spot via gps and I want to send a push notification.

Is this possible?


That’s no longer a local notification, that’s a push notification. You’d need the push notification plugin instead, and presumably the background gps plugin based on your example.


Okay well how would I achieve something like… the user just pushes a button and a notification is pushed?

while they are still within the app…

I know I could use a toast, but is it possible to send a local notification this way?


Here’s a simple rule, if the app is open and either needs to react directly to the user, or if you can schedule a specific time then use local notifications. If you need to send a notification when the app is closed and you don’t have a specific time you need to schedule for use a push notification.

So yes you can have it send the notification when they press a button. Did you already try that? Did it work? What error did you get? Do you have sample code? It should work just fine.


Thanks for the help, this is what I’m trying

I have added this plugin…

ionic plugin add de.appplant.cordova.plugin.local-notification

imported it…

import {LocalNotifications} from 'ionic-native';

In my constructor I have this…

  constructor(public navParams: NavParams) {
        title: "Test Title",
        text: "Delayed Notification",
        at: new Date(new Date().getTime() + 5 * 1000),
        sound: null

But I get no notification.


Okay, so you’re scheduling it for 5 seconds from the time it’s set if I’m reading that right. First question is how are you testing this? You need to actually build and deploy to your device or emulator to test this. Next I’d make sure you set an ID for the notification, and then call getScheduled (https://ionicframework.com/docs/native/local-notifications/#getScheduled) with the ID and see if it comes back. Or even easier call getAll and see if anything comes back at all (https://ionicframework.com/docs/native/local-notifications/#getAll). That will tell you if it’s registered, and should return the notification so you can check if the date/time is accurate.

If none of that works check both the web console logs and the actual device logs and see if you get any errors.


Thanks, I finally did get this to work, Im still using the same code and it just is working now for some reason.

Thank you.

this.platform.ready().then(() => {
  if ((this.platform.is('cordova'))) {

    title: "Test Title",
    text: "Delayed Notification",
    at: new Date(new Date().getTime() + 5 * 1000),
    sound: null
  } //cordova
}).catch((err) => {
  console.error("platform ready err=", err);