I have small issue when I test the local notification on my real devic
The notification work fine but the data can’t be read when i click on notification icon
Here is my code
this.localNotifications.schedule({
id: 1,
title: "sending data" ,
text: "click me to show an alert",
at: notificationTime,
data: { event:"show me a msg" }
});
constructor(platform: Platform, ... , public localNotifications: LocalNotifications) {
platform.ready().then(() => {
this.localNotifications.on('click', (notification, state) => {
let notiData = JSON.parse(notification.data);
if(notiData.event=="show me a msg"){
alert("Hi Ali, I received the data :)");
}
});
});
}
ionic info :
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v6.10.0
npm : 3.10.10
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
and local notification version is
"@ionic-native/local-notifications": "^4.5.3",