【发布时间】:2019-11-25 12:58:59
【问题描述】:
在我的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)
【问题讨论】:
标签: cordova ionic-framework cordova-plugins ionic4