我正在使用 zo0r react-native-push-notification库。
出于某种原因,当我在移动设备(或)app上安装它后第一次打开它时,令牌返回为空。iOSAndroid
PushNotification.configure({
onRegister: function(token) {
console.log( 'TOKEN:', token );
},
onNotification: function(notification) {
console.log( 'NOTIFICATION:', notification );
},
senderID: "YOUR GCM SENDER ID",
permissions: {
alert: true,
badge: true,
sound: true
},
popInitialNotification: true,
requestPermissions: true,
});
我的问题是,如果 onRegister 方法将令牌返回为 null,那么获取令牌的最佳方法是什么?我必须在应用程序的其他屏幕中调用此功能吗?
"react": "16.0.0-alpha.6",
"react-native": "^0.44.3",
"react-native-push-notification": "^3.0.1"
谢谢您的帮助,
米奇