实例ID服务是否在应用程序升级时启动回调onTokenRefresh()? [英] Does Instance ID service initiate callback onTokenRefresh() on app upgrade?

查看:87
本文介绍了实例ID服务是否在应用程序升级时启动回调onTokenRefresh()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



参考实例ID服务是否在应用升级时启动回调onTokenRefresh()? /rel =nofollow noreferrer> doc 指出
令牌是唯一且安全的,但是您的应用程序或Instance ID服务可能需要在出现安全问题时或者在出现安全问题时刷新令牌用户在设备恢复过程中卸载并重新安装您的应用程序,您的应用程序必须实现一个侦听器来响应来自Instance ID服务的令牌刷新请求。


  1. 任何人都可以确认是否令牌刷新必须由应用程序处理或实例ID服务在应用程序升级时启动回调onTokenRefresh()?

  2. 如果通过实例ID服务处理它,则令牌刷新方案如果旧应用程序使用旧库进行gcm注册(gcm.register)并且新应用程序使用新库(实例ID),则在升级后处理


解决方案


  1. onTokenRefresh( )只会因特定原因触发,其中更新应用程序不是其中之一。请参阅我的答案此处



    链接你在评论中提到的是生成注册令牌的不推荐方式(GCM2 / waaay old GCM),与InstanceID生成的令牌(preFCM和FCM)不同。请参阅Ian Barber的答案此处


  2. 我不确定你在这里问什么。我了解流程的方式是FCM识别是否需要刷新令牌,如果是,则调用InstanceID服务(与客户端分离)以生成新的令牌。只要它生成令牌并且应用程序上线,它就会触发 onTokenRefresh()来通知您新的令牌。你对标记所做的事情取决于你。

  3. 没有特殊情况AFAIK。


    Does Instance ID service initiate callback onTokenRefresh() on app upgrade?

    Reference doc states that "Tokens are unique and secure, but your app or the Instance ID service may need to refresh tokens in the event of a security issue or when a user uninstalls and reinstalls your app during device restoration. Your app must implement a listener to respond to token refresh requests from the Instance ID service."

    1. Can anyone confirm if token refreshing has to be handled by app or Instance ID service initiates callback onTokenRefresh() on app upgrade?
    2. If its handled by Instance ID service, how is token refresh scenario handled after upgrade if old app uses old library for gcm registration(gcm.register) and new app uses new library(Instance ID)

    解决方案

    1. onTokenRefresh() only triggers for specific reasons, where updating the app isn't one of them. See my answer here.

      The link you mentioned in the comments is the deprecated way of generating a registration token (GCM2/waaay old GCM), which is different from InstanceID generated tokens (preFCM and FCM). See Ian Barber's answer here.

    2. I'm not sure what you're asking here. The way I understand the flow is FCM identifies if the token needs to be refreshed, if yes, it calls upon the InstanceID service (separate from the client) to generate a new one. As soon as it generates the token and the app goes online, it would trigger onTokenRefresh() to let you know of the new token. What you do with the token depends on you.

    Simple as that. No special scenarios AFAIK.

    这篇关于实例ID服务是否在应用程序升级时启动回调onTokenRefresh()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆