gpt4 book ai didi

java - 为什么 FirebaseInstanceIdService 服务在 Firebase 新更新中丢失了?

转载 作者:行者123 更新时间:2023-12-02 01:22:56 29 4
gpt4 key购买 nike

问题是,我想在我的聊天应用中使用 Firebase 云消息传递。在我的 android studio 中实现 firebase 文档,我需要创建一个扩展 FirebaseInstanceIdService 的类。然而,这项服务似乎缺失。

 public class MyFirebaseInstanceIdService extends  FirebaseInstanceIdService{
}

最佳答案

是的,新版本中已弃用 FirebaseInstanceIdService。现在您可以在 MyFirebaseMessagingService 中获取更新后的 token 。

MyFirebaseMessagingService 中,为更新的 token 引入了新方法(如果 token 过期)。

override fun onNewToken(token: String?) {
Log.d(TAG, "Refreshed token: $token")

// 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(token)
}

更多详情请访问fcm

关于java - 为什么 FirebaseInstanceIdService 服务在 Firebase 新更新中丢失了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57375395/

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