Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript FirebaseX没有';我没有firebaseInstanceId_Typescript_Firebase_Firebase Cloud Messaging_Cordova Plugins_Ionic4 - Fatal编程技术网

Typescript FirebaseX没有';我没有firebaseInstanceId

Typescript FirebaseX没有';我没有firebaseInstanceId,typescript,firebase,firebase-cloud-messaging,cordova-plugins,ionic4,Typescript,Firebase,Firebase Cloud Messaging,Cordova Plugins,Ionic4,我有这样的后端API: registerFcmToken(userIdToken: string, firebaseInstanceId: string, fcmToken: string): Promise<ConfirmationResponseModel> { // code } registerFcmToken(userIdToken:string,firebaseInstanceId:string,fcmToken: (弦):承诺

我有这样的后端API:

      registerFcmToken(userIdToken: string, firebaseInstanceId: string, fcmToken: 
string): Promise<ConfirmationResponseModel> {
        // code
      }
registerFcmToken(userIdToken:string,firebaseInstanceId:string,fcmToken:
(弦):承诺{
//代码
}
你能告诉我我应该寄什么吗<代码>firebaseInstanceId

我在这里使用FirebaseX插件:

我可以生成this.fcmToken=等待this.firebase.getToken()但是什么是
firebaseInstanceId

Firebase doc说:


但是FirebaseX的等价物是什么呢?

如果您检查代码,您可以看到有一个名为
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);
                }
            }
        });
    }


因此基本上
this.firebase.getId()
应该为您提供实例id

这里的问题是这也没有这样的方法?这些链接来自同一个Github存储库,也不确定该插件使用的firebase版本,但使用的方法
getToken()
已被弃用
this.firebase.getId()
说类型“FirebaseX”上不存在属性“getId”。为什么?这是版本:
“firebase”:“7.4.0”,
如果您编辑问题,解释您在此处尝试实现的目标,可能会有所帮助。现在的问题是,我们在猜测为什么您需要名为
firebaseInstanceId
的东西,以及它可以为没有显示代码的后端方法做什么。@DougStevenson我会将您的消息传递给我的后端开发人员,并让您知道我是否能从他那里得到任何消息。上面有一个前端代码。谢谢
     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);
                }
            }
        });
    }