onTokenRefresh 不会在签名的 APK 中被调用,如果之前安装的应用版本没有实现 FCM

onTokenRefresh not getting called in signed APK, if previous version of app installed doesn#39;t have FCM implemented(onTokenRefresh 不会在签名的 APK 中被调用,如果之前安装的应用版本没有实现 FCM)
本文介绍了onTokenRefresh 不会在签名的 APK 中被调用,如果之前安装的应用版本没有实现 FCM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 Android 应用程序版本 6 中实现了 FCM.onTokenRefresh() 如果以前没有安装我的应用程序,则会被调用.但是,当我的应用程序具有以前的版本(没有实现 FCM)并且我用版本 6 更新它时,onTokenRefresh() 没有被调用.

I have implemented FCM in version 6 of my Android application. onTokenRefresh() is getting called if my app is not previously installed. But when my app with a previous version (which did not have FCM implemeted) is already installed and I update it with version 6, then the onTokenRefresh() is not getting called.

我需要从 Play 商店卸载之前的应用版本,然后再安装新版本吗?

Do I need to uninstall the previous app version from Play Store and then install new version?

推荐答案

我认为这仍然应该是预期的行为.onTokenRefresh() 将在 第一次 应用安装时调用.不是每次都更新.所以也许,您可以手动强制 onTokenRefresh() 就像这篇 post 中提到的那样:

I think that should still be the intended behavior. onTokenRefresh() will be called the first time the app is installed. Not every time it's updated. So maybe, you could manually force the onTokenRefresh() like what is mentioned in this post:

如果您想手动强制 onTokenRefresh(),您可以创建一个 IntentService 并删除令牌实例.然后,当你调用getToken时,onTokenRefresh()方法会再次被调用.

If you would like to manually force the onTokenRefresh(), you can create an IntentService and delete the token instance. Then, when you call getToken, the onTokenRefresh() method will be called again.

这篇关于onTokenRefresh 不会在签名的 APK 中被调用,如果之前安装的应用版本没有实现 FCM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)