Android 安卓发送HTTP POST触发云功能改造

Android 安卓发送HTTP POST触发云功能改造,android,firebase,http,retrofit,google-cloud-functions,Android,Firebase,Http,Retrofit,Google Cloud Functions,我有一个使用“context.auth.uid”的云函数,出于JSON解析的原因,我想通过改型而不是Firebase函数API来触发它。但是当我尝试这样做时,我得到了这个错误:请求的内容类型不正确。app/googleservices.json。我不知道如何传递函数API传递的身份验证信息。 以下是我的代码: 云功能HTTP功能: exports.getMatches = functions.https.onCall((req, context) => { var uid = c

我有一个使用“context.auth.uid”的云函数,出于JSON解析的原因,我想通过改型而不是Firebase函数API来触发它。但是当我尝试这样做时,我得到了这个错误:
请求的内容类型不正确。app/googleservices.json
。我不知道如何传递函数API传递的身份验证信息。 以下是我的代码:

云功能HTTP功能:

exports.getMatches = functions.https.onCall((req, context) => {

    var uid = context.auth.uid;
    console.log("uid: ", uid);
});
用于改装的Android SearchAPI接口

公共接口ElasticSearchAPI
{
@POST(“getMatches/”)
调用getMatches(@Header(“内容类型”)字符串
内容类型,@Header(“授权”)字符串secretKey);
}
Android调用该函数

Call=searchAPI.getMatches(“app/google services.json”,“api_key”);

改型不知道如何调用,正如您在代码中声明的那样。他们有一个设计用于Firebase客户端SDK的


如果您想使用HTTP客户端库来调用云函数,则应改为使用,而不是使用可调用。请注意,它们的声明不同。一个是从
functions.https.onCall()
开始的,另一个是从
functions.https.onRequest()

开始的,这听起来像是另一个关于堆栈溢出的问题。
public interface ElasticSearchAPI
 {

    @POST("getMatches/")
    Call<ElasticHitsObject> getMatches(@Header("Content-Type") String 
    content_type,@Header("Authorization") String secretKey);

 }
   Call<ElasticHitsObject> call = searchAPI.getMatches("app/google-services.json","api_key");