如果我通过从 Firebase 控制台选择一个包来发送推送消息,则推送会发送到所有设备,但在发送到单个设备期间,它会显示错误:
If I send push message by selecting a package from Firebase console, the push goes to all devices, but during sending to individual device, it displays the error:
Invalid reg token,please check token format
错误快照:
控制台中的 UserID 不是 Firebase 消息传递的注册令牌.Firebase 文档:
UserID in console is not the registration token for Firebase messaging. By Firebase docs:
在您的应用首次启动时,FCM SDK 会为客户端应用实例生成一个注册令牌.如果您想定位单个设备或创建设备组,则需要通过扩展 FirebaseInstanceIdService 来访问此令牌.
on initial startup of your app, the FCM SDK generates a registration token for the client app instance. If you want to target single devices or create device groups, you'll need to access this token by extending FirebaseInstanceIdService.
我的最后一个注册令牌看起来像cpeBAc1NkUE:APA91bEpAKHQTdgkWVdDzDZG8BPon0APaIhbbuSejDpZF-FO1gD2saDV7_EQDo2WEz0H6e5U-uf0i-v4b25NXgGzV2oUrNuboM5675WY7VCP3JcBl8BCNY7eV0VFGHT9oRox0EEoo_ch
My last registration token looks like cpeBAc1NkUE:APA91bEpAKHQTdgkWVdDzDZG8BPon0APaIhbbuSejDpZF-FO1gD2saDV7_EQDo2WEz0H6e5U-uf0i-v4b25NXgGzV2oUrNuboM5675WY7VCP3JcBl8BCNY7eV0VFGHT9oRox0EEoo_ch
这篇关于Firebase 通知 - 注册令牌无效,请检查 Android 中的令牌格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!