【问题标题】:firebase clearAllNotifications() not working in ionic 3firebase clearAllNotifications() 在 ionic 3 中不起作用
【发布时间】:2019-03-29 06:14:13
【问题描述】:

我需要删除 ionic 3 中的旧通知表单状态栏。

我使用过 firebase 插件("@ionic-native/firebase": "^4.20.0""cordova-plugin-firebase": "2.0.5"强>)。这是 app.component.ts 文件

  import { Firebase } from '@ionic-native/firebase';

  constructor(private platform: Platform,
      statusBar: StatusBar,
      splashScreen: SplashScreen,
      public firebase: Firebase) {

        platform.ready().then(() => {
            this.firebase.clearAllNotifications().then(clearData => {
                console.log('removed all notification');
            }).catch(err => {
                console.log('error in removing notification');
            });
        });
    }

并给出类似的错误

ERROR: Unhandled Promise rejection: undefined is not an object (evaluating 'this.fcm.clearAllNotifications().then') ; Zone: <root> ; Task: setTimeout ; Value: TypeError: undefined is not an object (evaluating 'this.fcm.clearAllNotifications().then')

如何实现这个功能,谁能帮帮我。

谢谢。

【问题讨论】:

  • 编写一个原生接口并放置 handler.delay 可能是你的 ui 线程排队的项目太多
  • 你能在打开应用时提供android logcat吗?

标签: firebase push-notification ionic3


【解决方案1】:
@ionic-native/firebase": "^4.20.0"

没有可用的方法叫clearAllNotifications()你必须下载最新版本或需要手动添加here

【讨论】:

    猜你喜欢
    • 2017-04-10
    • 1970-01-01
    • 2018-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-04
    • 1970-01-01
    相关资源
    最近更新 更多