[英]FirebaseX doesn't have firebaseInstanceId
我有這樣的后端 API:
registerFcmToken(userIdToken: string, firebaseInstanceId: string, fcmToken:
string): Promise<ConfirmationResponseModel> {
// code
}
你能告訴我應該送什么到這里嗎? firebaseInstanceId
我在這里使用 FirebaseX 插件: https : //github.com/dpa99c/cordova-plugin-firebasex#api
我可以生成this.fcmToken = await this.firebase.getToken();
但什么是firebaseInstanceId
?
Firebase 文檔說: https ://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId.html#public-taskinstanceidresult-getinstanceid-
但 FirebaseX 的等價物是什么?
如果檢查代碼,您可以看到有一個名為getId()
的方法:
https://github.com/dpa99c/cordova-plugin-firebasex/blob/master/www/firebase.js#L14
exports.getId = function (success, error) {
exec(success, error, "FirebasePlugin", "getId", []);
};
此方法調用 java 類FirebasePlugin
中的getId()
方法:
private void getId(final CallbackContext callbackContext) {
cordova.getThreadPool().execute(new Runnable() {
public void run() {
try {
String id = FirebaseInstanceId.getInstance().getId();
callbackContext.success(id);
} catch (Exception e) {
handleExceptionWithContext(e, callbackContext);
}
}
});
}
https://github.com/dpa99c/cordova-plugin-firebasex/blob/master/src/android/FirebasePlugin.java#L392
所以基本上this.firebase.getId()
應該給你實例 id
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.