typescript - FirebaseX 没有 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
?
但是 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", []);
};
此方法正在调用getId()
java 类中的方法FirebasePlugin
:
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
推荐阅读
- eslint - 苗条与漂亮/eslint
- javascript - NodeJS require() 无法访问模块并且不返回任何函数
- vba - VBA 舍入函数,存储其值以供以后使用,收到“溢出”错误消息
- python - 从条目中获取值以在框架内
- python-3.x - 如何在 sklearn 中执行 train_test_split 但根据列的某个成员限制/指定输出?关闭
- javascript - vue + 复选框 + 更改事件 - 页面和控制台上的不同结果
- jenkins - 我们如何在两个 Jenkins 大师之间共享凭证
- python - 由于项目主 urls.py 中的配置错误,Django 无法正确处理获取请求
- discord.py - 如何实现暂停命令(lavalink)?
- javascript - event.stopPropagation() 不起作用 - 捕获仍然传递函数