简体   繁体   English

带有 phonegap-plugin-push 的空通知

[英]Empty notification with phonegap-plugin-push

I'm using push notifications in my ionic+phonegap-plugin-push app without problem.我在 ionic+phonegap-plugin-push 应用程序中使用推送通知没有问题。

Everything works fine BUT, once a day or so I get a blank notification, no message, nothing but the app icon and there is no way you can remove that notification from the "notification center".一切正常,但是,每天一次左右,我收到一条空白通知,没有消息,只有应用程序图标,而且您无法从“通知中心”中删除该通知。

It seems to happen only in android so I guess is related to the push plugin or maybe something related to the new firebase back, ionic, ...no idea seriously.它似乎只发生在 android 中,所以我想这与 push 插件有关,或者可能与新的 firebase back、ionic、...无关。

Any ideas?有任何想法吗? According to the logs in the server the payloads are the right ones and I'm not able to reproduce it.根据服务器中的日志,有效负载是正确的,我无法重现它。

I'm using:我正在使用:

  • cordova --version: 6.4.0科尔多瓦--版本:6.4.0
  • cordova platform version android: 5.1.1科尔多瓦平台版本安卓:5.1.1
  • cordova plugin version:科尔多瓦插件版本:
    • cordova-plugin-app-event 1.2.0 "Application Events" cordova-plugin-app-event 1.2.0“应用程序事件”
    • cordova-plugin-background-fetch 4.0.0 "CDVBackgroundFetch" cordova-plugin-background-fetch 4.0.0 "CDVBackgroundFetch"
    • cordova-plugin-background-mode 0.7.1 "BackgroundMode"科尔多瓦插件背景模式 0.7.1 “背景模式”
    • cordova-plugin-badge 0.7.4 "Badges" cordova-plugin-badge 0.7.4“徽章”
    • cordova-plugin-camera 2.3.1 "Camera"科尔多瓦插件相机2.3.1“相机”
    • cordova-plugin-compat 1.1.0 "Compat"科尔多瓦插件兼容 1.1.0 “兼容”
    • cordova-plugin-console 1.0.5 "Console"科尔多瓦插件控制台 1.0.5 “控制台”
    • cordova-plugin-datepicker 0.9.2 "DatePicker"科尔多瓦插件日期选择器 0.9.2 “DatePicker”
    • cordova-plugin-device 1.1.4 "Device"科尔多瓦插件设备 1.1.4 “设备”
    • cordova-plugin-file 4.3.1 "File"科尔多瓦插件文件 4.3.1 “文件”
    • cordova-plugin-file-transfer 1.6.1 "File Transfer" cordova-plugin-file-transfer 1.6.1 “文件传输”
    • cordova-plugin-inappbrowser 1.6.1 "InAppBrowser" cordova-plugin-inappbrowser 1.6.1 “InAppBrowser”
    • cordova-plugin-network-information 1.3.1 "Network Information" cordova-plugin-network-information 1.3.1 “网络信息”
    • cordova-plugin-splashscreen 4.0.1 "Splashscreen" cordova-plugin-splashscreen 4.0.1 “Splashscreen”
    • cordova-plugin-statusbar 2.2.1 "StatusBar"科尔多瓦插件状态栏 2.2.1 “状态栏”
    • cordova-plugin-vibration 2.1.3 "Vibration" cordova-plugin-vibration 2.1.3 “振动”
    • cordova-plugin-whitelist 1.3.1 "Whitelist"科尔多瓦插件白名单 1.3.1 “白名单”
    • ionic-plugin-deploy 0.6.5 "IonicDeploy"离子插件部署 0.6.5 “IonicDeploy”
    • ionic-plugin-keyboard 2.2.1 "Keyboard"离子插件键盘 2.2.1 “键盘”
    • phonegap-plugin-push 1.8.4 "PushPlugin" phonegap-plugin-push 1.8.4 “PushPlugin”

I thought it was a problem with the phonegap push plugin but it was not.我认为这是 phonegap push 插件的问题,但事实并非如此。

I was also using the cordova-plugin-background-mode which internally creates a local notification to wake up the app in the background.我还使用了cordova-plugin-background-mode ,它在内部创建了一个本地通知来在后台唤醒应用程序。

My code configures the plugin with silent mode so it is supposed to create a local notification that doesnt show up anywhere.我的代码将插件配置为静默模式,因此它应该创建一个不会出现在任何地方的本地通知。

        $ionicPlatform.ready(function () {
            cordova.plugins.backgroundMode.setDefaults({ silent: true });
            cordova.plugins.backgroundMode.enable();

            cordova.plugins.backgroundMode.onactivate = function () {
                //my own stuff here...
            };
        });

There is a closed issue that reflects this ( https://github.com/katzer/cordova-plugin-background-mode/issues/89 ) and according to some comments and my own experience it is still happening.有一个已解决的问题反映了这一点( https://github.com/katzer/cordova-plugin-background-mode/issues/89 ),根据一些评论和我自己的经验,它仍在发生。

Hope it helps.希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM