Nativescript-local-notifications plugin not displaying notifications


#1

So, I’ve been playing around with Nativescript + Angular2 and recently I’m trying to show local notification on an Android device.

The application uses the nativescript-plugin-firebase to fetch data from my firebase db and I installed the nativescript-local-notifications plugin to schedule notifications.

Here is what I do: in my app.component.ts I listen to the application status events (suspended or resumed). I added a firebase child event listener when the app is suspended and every time a child is added I schedule a new notification. The notifications is successfully scheduled but nothing appear on my device’s status bar.

As a matter of fact, I also tried to schedule notifications after clicking on a button (as showed here) and it didn’t work. It happens the same thing I described above. Anyone has any clue why this is happening?

On suspend event code (firebase child event listener + notifications scheduler):

application.on(application.suspendEvent, () => {

      firebase.addChildEventListener(result => {

        switch(result.type){
          case 'ChildAdded':

            LocalNotifications.schedule([{
              id: 1,
              title: title,
              body: body,
              ticker: ticker,
              badge: 1,
              at: new Date(new Date().getTime() + 5*1000)
            }]).then(
                () => {
                  console.log("Notification scheduled");
                },
                (error) => {
                  console.log("scheduling error: " + error);
                }
            );
            break;
          default:
            break;
        }
      }, path).then( wrapper => {
        
        this.wrapper = wrapper;
      });
 });

Cheers!

PS: I tested the code on a Samsung Galaxy S6 running Android 6.0.1


#2

Same issue for me…


#3

Unfortunately I can’t provide an answer to this. To be honest, I gave up trying to solve it and instead of scheduling a local notification now I make a request to a server and there I send notifications to a topic haha


#4

same issue on iPhone 10 ios 11.4, any fixes?