
我已经尝试了所有可用的答案,但无济于事.我在这里错过了什么?
private voID sendRegistrationToServer(String token)`{}解决方法:
正如评论部分所述,问题很模糊,但我有点得到你所要求的.
sendRegistrationToServer()是一个可选方法,可以在Firebase的大多数示例中看到.从GitHub example开始:
package com.@R_301_5561@.firebase.quickstart.fcm;import androID.util.Log;import com.@R_301_5561@.firebase.iID.FirebaseInstanceID;import com.@R_301_5561@.firebase.iID.FirebaseInstanceIDService;public class MyFirebaseInstanceIDService extends FirebaseInstanceIDService { private static final String TAG = "MyFirebaseIIDService"; /** * Called if InstanceID token is updated. This may occur if the security of * the prevIoUs token had been compromised. Note that this is called when the InstanceID token * is initially generated so this is where you would retrIEve the token. */ // [START refresh_token] @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); } // [END refresh_token] /** * Persist token to third-party servers. * * Modify this method to associate the user's FCM InstanceID token with any server-sIDe account * maintained by your application. * * @param token The new token. */ private voID sendRegistrationToServer(String token) { // Todo: Implement this method to send token to your app server. }}从这里,您可以看到在onTokenRefresh()内部调用sendRegistrationToServer(),其中生成用于FCM的注册令牌.代码文档已经告诉sendRegistrationToServer()中应该发生什么:
Persist token to third-party servers. Modify this method to associate the user’s FCM InstanceID token with any server-sIDe account maintained by your application.
将注册令牌发送到您自己的App Server是可选的,但强烈建议这样做(见FCM docs).这样您就可以拥有令牌供将来使用.
总结以上是内存溢出为你收集整理的android – private void sendRegistrationToServer(String token)参数令牌从不使用全部内容,希望文章能够帮你解决android – private void sendRegistrationToServer(String token)参数令牌从不使用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)