gpt4 book ai didi

android - FCM token 何时到期?

转载 作者:IT老高 更新时间:2023-10-28 23:19:32 25 4
gpt4 key购买 nike

FCM token 何时到期?是6个月吗?

最佳答案

但它不会过期。如果发生以下情况之一,它会自行更新。

根据https://firebase.google.com/docs/cloud-messaging/android/client :

  1. -应用删除Instance ID
  2. -应用在新设备上恢复
  3. -用户卸载/重新安装应用程序
  4. -用户清除应用数据。

Monitor token generation

The onTokenRefreshcallback fires whenever a new token is generated, so calling getToken in its context ensures that you are accessing a current, available registration token. Make sure you have added the service to your manifest, then call getToken in the context of onTokenRefresh, and log the value as shown:

@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
sendRegistrationToServer(refreshedToken);
}

编辑

onTokenRefresh()现在已弃用。 onNewToken()应改为使用。

关于android - FCM token 何时到期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41982619/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com