question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LocalNotification not coming after device reboot

See original GitHub issue

Notifiocation not triggered after device reboot.

Your Environment

  • Plugin version: cordova.plugin.local-notification 0.9.0-beta.3
  • Platform: Android
  • OS version: Android 7.1.2
  • Device manufacturer / model: Redmi 5A
  • Cordova version (cordova -v): 8.1.2
  • Cordova platform version (cordova platform ls): Android 7.1.4
  • Plugin config
  • Ionic Version (if using Ionic): 4.9.0

Expected Behavior

Notification should trigger on time

Actual Behavior

not trigger at time after device reboot

Code

SaveNotification(){ console.log(“— Schedule at -----”,this.date+“-----”+this.id);

cordova.plugins.notification.local.schedule({
  id: this.id,
  title: 'Attention',
  text: 'Local Notification',
  data: { mydata: 'My hidden message this is' },
  trigger: {at: new Date(this.date)},
});

this.id++

}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
GitToTheHubcommented, Feb 27, 2020

Great you found a solution 😃

1reaction
husainsrcommented, Feb 27, 2020

If i install using reading Ionic Documentation it is not working. But installing manually using “Katzer Plugin” it is working My workaround is :

1.) cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications 2.) npm uninstall --save @ionic-native/local-notifications 3.) Remove LocalNotification from app.module.ts.

Then install using cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications

Now use this

import { Component } from '@angular/core';
import { NavController,LoadingController } from 'ionic-angular';
import { DatePicker } from '@ionic-native/date-picker';
import { FormGroup, FormControl } from '@angular/forms';

declare var cordova;

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
  date: any;
  constructor(private datePicker: DatePicker) {
  }

  openDate(){
    this.datePicker.show({
      date: new Date(),
      mode: 'datetime',
      androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_DARK
    }).then(
      date => {      this.date = date  },
      err => console.log('Error occurred while getting date: ', err)
    );
  }


  SaveNotification(){
    let id = Number(Math.random().toString().substr(2,5) + Date.now());
    cordova.plugins.notification.local.schedule({
      id: id,
      title: 'Attention - ' + id,
      text: 'Demo Notification',
      data: { mydata: 'My hidden message this is' },
      trigger: {at: new Date(this.date)},
    });
  }
}


Read more comments on GitHub >

github_iconTop Results From Across the Web

xamarin - Local Notification Does not Show After Device Reboot
I hate to delete a question from the internet. The issue on boot received was using dependency injection in the boot receiver.
Read more >
Local notifications get lost after android reboot - Ionic Forum
The local notifications in my App get lost after I'm restarting my android phone. Before the restart the local notifications work fine.
Read more >
[Solved]-Local Notification rescheduling after reboot iOS
And when device reboots it just invokes all active notifications as if there was no reboot at all. So for sure there is...
Read more >
local notification plays only default sound after app update
The issue does not come back, unless the user redownloads the app. You can check if you are an update running 10.0.x and...
Read more >
Creating Local Notifications in Flutter - Kodeco
So, build and run the app to ensure it works for Android and iOS before going forward. Building the Local Notification Helper Library....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found