Cordova-plugin-local-notifications: local notification doesn't work in ionic 3

Created on 18 Dec 2017  路  10Comments  路  Source: katzer/cordova-plugin-local-notifications

No errors on building the app but when i try it on android phone. there i no notification popup. what's wrong with it?

Ionic Info:

cli packages: (C:\Users\13890\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.5
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v6.11.5
npm  : 3.10.10
OS   : Windows 7

Sample Code:

import { Component } from '@angular/core';
import { NavController, AlertController } from 'ionic-angular';

import { LocalNotifications } from '@ionic-native/local-notifications';

@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {

constructor(public navCtrl: NavController, private localNotifications: LocalNotifications, public alertCtrl: AlertController) {

    this.localNotifications.on('click', (notification, state) => {
        console.log('click');

      let json = JSON.parse(notification.data);

      let alert = alertCtrl.create({
        title: notification.title,
        subTitle: json.mydata
      });
      alert.present();
    });
}
scheduleNotification() {
  this.localNotifications.schedule({
    id: 1,
    title: 'Attention',
    text: 'Simons Notification',
    data: { mydata: 'My hidden message this is' }
  });
}

}](url)

Note: Done Adding localNotification on app.module.ts

Most helpful comment

@YamanSehzade you need to use this command ionic cordova plugin add [email protected]
if you have questions, check please wiki for 0.8 branch

All 10 comments

Please help me what to do with this.

hi @YamanSehzade

Do you have any idea about it? when i check to the documentation it is not beta. in config.xml the plugin still in beta and mostly of the forums are using apple product. any idea on the android side?

you can not use local notification plugin with current ionic plugin wrapper because it outdated.
there is issue opened 14 Nov, and no info when wrapper will be updated.

@normanaranez sorry for late reply.
I already have a problem on android. it is not working.

@himinat i don't understand. Will we not be able to use this plugin now ? Can you explain, please ?

When i try to add 0.8.5, i get this error;
image

@YamanSehzade you need to use this command ionic cordova plugin add [email protected]
if you have questions, check please wiki for 0.8 branch

any idea when to release the version for the android?

Hi...if someone is still wondering... I solved it installing first the local notification plugin dependencies first and then the plugin itself with version 0.8.5
Using --nofetch was installing but I was not able to build...
you can see it here:
https://github.com/katzer/cordova-plugin-local-notifications/issues/1477

it doesn't work !!!! helppppp

Please always see the tagged README for the plugin version and not whats written for master branch.
With v0.9 the id of the plugin has changed. You have to use the old id if you want to use v0.8.x

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kasendwa picture Kasendwa  路  3Comments

sharatchandra99 picture sharatchandra99  路  5Comments

GitToTheHub picture GitToTheHub  路  4Comments

Shashank2406 picture Shashank2406  路  5Comments

neshke89 picture neshke89  路  4Comments