Android 当apk已上载到playstore中时,Firebase ID始终返回null
我已经花了很长时间从我的应用程序中搜索bug。我的应用程序使用FCM并在第一次安装时获取FCM ID 当我将应用程序从笔记本电脑直接安装到手机或模拟器时,我可以在logcat输出中看到FCM id并将其保存到我们的db服务器。当我使用生成的调试或签署的发布APK进行安装时,它也可以工作 问题是,当在playstore中上传已签名的版本APK success full并尝试从中安装时,我总是得到FCM的null返回。有人能解释一下吗 这是密码Android 当apk已上载到playstore中时,Firebase ID始终返回null,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,我已经花了很长时间从我的应用程序中搜索bug。我的应用程序使用FCM并在第一次安装时获取FCM ID 当我将应用程序从笔记本电脑直接安装到手机或模拟器时,我可以在logcat输出中看到FCM id并将其保存到我们的db服务器。当我使用生成的调试或签署的发布APK进行安装时,它也可以工作 问题是,当在playstore中上传已签名的版本APK success full并尝试从中安装时,我总是得到FCM的null返回。有人能解释一下吗 这是密码 public class MyFirebaseMess
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = MyFirebaseMessagingService.class.getSimpleName();
private NotificationUtils notificationUtils;
@Override
public void onNewToken(String token_fcm) {
super.onNewToken(token_fcm);
Log.e("NEW_TOKEN",token_fcm);
storeRegIdInPref(token_fcm);
// cann REST API to save FCM ID
Utility.registerFCMToDatabase(getApplicationContext(),token_fcm);
}
private void storeRegIdInPref(String token) {
SharedPreferences pref = getApplicationContext().getSharedPreferences(Config.SHARED_PREF, 0);
SharedPreferences.Editor editor = pref.edit();
editor.putString("regId", token);
editor.commit();
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.e(TAG, "From: " + remoteMessage.getFrom());
}
}