我正在尝试将 Push Notification 用于我的移动应用程序,并尝试使用Ionic IO PushPushWoosh,现在OneSignal,两者都存在同样的问题 .

One Signal documentation about push notification not being sent中,它表示应用程序可能处于 Force Closed 状态,如果是,则在 logcat 中,您将在尝试发送推送通知时看到此消息:

W / GCM-DMM:广播意图回调:result = CANCELED forIntent {act = com.google.android.c2dm.intent.RECEIVE pkg = com.onesignal.example(has extras)}

所以,为了看到它,我使用命令 adb logcat grep | 'GCM' 来查看我的设备是否正在发送此消息 .

是的,确实如此 .

如果应用程序是 Forced Closed ,则可以显示它,但是当应用程序是 OpenBackground 时也会显示错误消息 .

我发现它很奇怪,因为当应用程序处于打开状态时,或者在后台时,我可以接收推送通知,并按照我的意愿处理它,即使错误消息显示在 logcat 中,但是当我关闭它时,没有更多的通知,错误消息一直出现在 logcat 中 .

我试过了什么?

我的配置

  • 配置:

  • 离子CLI:3.6.0

  • Cordova CLI:6.5.0

  • @ ionic-native / onesignal:4.1.0

  • 设备:联想K5

  • 插件列表

  • ionic cordova plugin list

  • cordova-plugin-app-event 1.2.0 "Application Events"

  • cordova-plugin-autostart 2.0.1 "Autostart"

  • cordova-plugin-console 1.0.7 "Console"

  • cordova-plugin-device 1.1.6 "Device"

  • cordova-plugin-splashscreen 4.0.3 "Splashscreen"

  • cordova-plugin-statusbar 2.2.3 "StatusBar"

  • cordova-plugin-whitelist 1.3.2 "Whitelist"

  • de.appplant.cordova.plugin.local-notification 0.8.5 "LocalNotification"

  • ionic-plugin-keyboard 2.2.1 "Keyboard"

  • onesignal-cordova-plugin 2.1.2 "OneSignal Push Notifications"