i want after restart phone show notification after 3 minute.
my code:
ionViewDidLoad() {
this.Time = 60*3;
this.shownotification();
this.autostart.enable();
console.log(‘ionViewDidLoad LocalPage’);
}
shownotification() {
let timewait = this.Time* 1000;
let notifi = {
id: this.i++,
title: “Time !!!”,
text: “Yoyoyo PicPic”,
at: new Date(new Date().getTime() + timewait),
icon: ‘file://img/clock1.png’
};
LocalNotifications.schedule(notifi);
console.log(notifi);
BackgroundMode.enable();
}
But i restart phone not show notification. where am i wrong ? . I see http://ionicframework.com/docs/native/autostart/. Thanks
Does the app restart after you restart the phone?
No i think it will auto start app for me
This answer makes no sense, I don’t understand it
sorry, app not restart after restart phone
Then it is quite normal that you don’t get a notification if the autostart doesn’t work.
i set this.autostart.enable(); for app. i think if enable for it then after restart phone it auto start. I wrong ?
That is what it says in the documentation.
But if it isn’t working, your problem is not that “notification doesn’t show” but “autostart doesn’t work”.
- What is your
ionic info
output?
- What does
ionic cordova plugin list
return?
- What does your constructor look like in that file?
- Did you https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module