【问题标题】:Capturing click event on ionic 4 local notification in IOS device在 IOS 设备中的 ionic 4 本地通知上捕获点击事件
【发布时间】: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


    【解决方案1】:

    我试图通过“ionic Devapp”运行我的应用程序,结果发现它在 Devapp 中无法运行。

    当我尝试使用 ionic cordova run ios 运行它时,它运行良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-18
      • 2019-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-05
      相关资源
      最近更新 更多