简体   繁体   English

cordova phonegap-plugin-push v1.x-如何使其与Android 8.1配合使用(API级别27)

[英]cordova phonegap-plugin-push v1.x - how to make it work with Android 8.1 (API level 27)

We use the phonegap-plugin-push in one of our apps and it works really well - up to Android 7 (haven't tested Android 8). 我们在其中一个应用程序中使用了phonegap-plugin-push功能,并且效果非常好-最高支持Android 7(尚未测试Android 8)。

However, Android 8.1 phone don't show notifications 但是,Android 8.1手机不显示通知

we use 我们用

 cordova CLI 8.1.2
 cordova-android 6.4.0
 phonegap-plugin-push 1.10.7

As android platform 6.x does not support API level 27 , we updated to android platform 7.1.1 - no effect 由于Android平台6.x不支持API级别27 ,因此我们更新为android平台7.1.1-无效

Then, we updated to phonegap-plugin-push 1.11.1 - also no effect. 然后,我们更新为phonegap-plugin-push 1.11.1-也无效。

I'd really be glad to hear which versions you are using and if / how you manage get push notifications also on Android 8.1 ... or any other ideas how to make this work? 我真的很高兴听到您使用的是哪个版本,以及是否/如何在Android 8.1上也获得推送通知...或任何其他想法来实现此功能?

Do I need to upgrade to the push plugin v2.x branch? 我需要升级到推送插件v2.x分支吗?

Thanks for any help in advance! 感谢您的任何帮助!

Well, when reading the documentation you understand that the support for channels which is required for Android >= 8 is only supported by the 2.x versions of the phonegap-plugin-push. 好了,在阅读文档时,您了解到Android> = 8所需的通道支持仅受phonegap-plugin-push的2.x版本支持。

In fact, updating wasn't that complicated. 实际上,更新并不是那么复杂。 You need to: 你需要:

  • register with FCM and get the google-services.json (and put it in the config.xml, see docs) 向FCM注册并获取google-services.json(并将其放入config.xml中,请参阅文档)
  • remove all GCM IDs you might sill have in your code and config.xml 删除您可能在代码和config.xml中可能拥有的所有GCM ID
  • and you should add the channels as you would get the default text otherwise in the Android config 并且您应该添加频道,因为您将获得默认文本,否则在Android配置中

Also notice that by now (2.2.3) you have to check for the android platform before calling listChannels() as this there is no dummy implementation for the other platforms (yet). 还要注意,到目前为止(2.2.3),您必须在调用listChannels()之前检查android平台,因为这对于其他平台还没有虚拟实现(尚未)。

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

相关问题 无法使用phonegap-plugin-push,cordova-plugin-crosswalk-webview和cordova-plugin-health来构建cordova android - unable to make cordova android build with phonegap-plugin-push, cordova-plugin-crosswalk-webview, and cordova-plugin-health 科尔多瓦编译错误phonegap-plugin-push android - cordova compile error phonegap-plugin-push android 反应原生推送通知在Android 8.1(API级别27)中不起作用 - react native push notification doesn't work in Android 8.1 (API level 27) 添加phonegap-plugin-push后,Phonegap android失败 - Phonegap android failing after adding phonegap-plugin-push phonegap-plugin-push 2.x注册未触发 - phonegap-plugin-push 2.x registration not firing 收到推送通知时cordova.js发生错误-phonegap-plugin-push,ionic - Error at cordova.js while receiving a push notification - phonegap-plugin-push , ionic 带有 phonegap-plugin-push 的空通知 - Empty notification with phonegap-plugin-push phonegap-plugin-push不注册 - phonegap-plugin-push do not register 发送消息时,带有phonegap-plugin-push 2.0.0的应用程序android崩溃 - App with phonegap-plugin-push 2.0.0 android crashes when a message is sent cordova phonegap-如何使用android API级别21 - cordova phonegap - How to use android API level 21
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM