Local notification not working when app is close

Hi all ! Could anyone suggest please … I am use Cordova Local-Notification Plugin and the notification doesn’t appear again when the app was closed … Is there any solution ??

  id: Math.floor(Math.random() * (1000000000 - 1) + 1),
  title: 'Mobile',
  text: 'Updating Complete!',
  sound: (this.platform.is('android') && this.settingsProvider.settings.sound == true) ? 'file://assets/sounds/android.mp3' : 'file://assets/sounds/android.mp3',
  badge: 1,
  icon: 'file://assets/icon/download.png',
  smallIcon: 'file://assets/icon/download.png'

I apologize, the problem was not in the plugin.

Hey I have the same problem. When i kill the app on android the notfication doesn’t appears. So I would like to know if you solved it?

Hey, I am facing the same problem. How did you solve it?

I got it .Thanks.If anyone else is facing the same issue, just try to declare this.localNotifications.on(‘click’, (success)=>{ alert(“clicked”) } on the landing/home page.

How it will trigger ? will it trigger even app close ?

Probably yes. If you see the provided code above the other user tells it fixed his problem to declare inside the landing/home page

this.localNotifications.on('click', (success) => { 

If you have further problems just let us know.

No i am not getting any local notification when app close

Can you provide your .ts file so I can check for you?

import { Component } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { StatusBar } from ‘@ionic-native/status-bar’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;
import { LocalNotifications } from ‘@ionic-native/local-notifications’;

import { HomePage } from ‘…/pages/home/home’;
templateUrl: ‘app.html’,
export class MyApp {
rootPage:any = HomePage;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,private localNotifications: LocalNotifications) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
alert('Alert ')
text: ‘Delayed ILocalNotification’,
at: new Date(new Date().getTime() + 60000),
led: ‘FF0000’,
sound: null

 this.localNotifications.on('click', (success)=>{ alert("clicked") });


declare this in your home/landing page:
this.localNotifications.on(‘click’, (success)=>{ alert(“clicked”) });
and see if it works.

1 Like

i was declared both in app.componnent.ts only

Include it in your home.ts

1 Like

Not working for me: Parameter ‘success’ implicitly has an ‘any’ type, but a better type may be inferred from usage.ts(7044)
‘success’ is declared but its value is never read.ts(6133)
Expected 1 arguments, but got 2.ts(2554)