在我的ionic 4
应用中,我可以使用cordova
本地通知插件(doc.)在单击按钮时触发本地通知,但是当用户单击通知时,无法找到捕获事件的方法旗帜。单击通知后,它仅重定向到应用程序,但没有输入'on click'
功能。在android设备上进行测试时,它工作正常,但没有ios运气。
提前感谢您的帮助。
这是我的代码:
constructor(
private localNotifications: LocalNotifications,
public platform: Platform,
) {
this.platform.ready().then(() => {
this.localNotifications.on('click').subscribe(notification => {
console.log('click on notification fired);
});
}
notify() {
this.localNotifications.schedule({
title: `my test notification`,
text: `my detailed description`,
trigger: {
in: 3000,
unit: ELocalNotificationTriggerUnit.SECOND,
},
});
}
这是我的离子信息:
Ionic:
Ionic CLI : 5.4.5 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.5
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 7.0.0
Cordova Platforms : android 8.0.0, browser 6.0.0, ios 4.4.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 10 other plugins)
我试图通过'ionic Devapp'运行我的应用程序,结果证明它无法在Devapp中运行。
[当我尝试使用ionic cordova run ios
运行它时,它工作正常。