小编bhw*_*994的帖子

Google Cloud Functions-客户端调用错误(Android Studio):FirebaseFunctionsException:响应无效的JSON对象

无法执行Google Cloud Functions Android客户端调用。

我从云控制台创建Cloud Function,并在云控制台上测试工作。

但在Android客户端应用程序上,它不起作用。

因此,我的确在Android Studio上导入了Google Cloud Service快速入门项目,也出现了同样的错误。

这是快速启动项目的URL。

https://cloud.google.com/functions/docs/quickstart-console

这是我的代码。

Google Cloud Functions呼叫类别

public class TestClass {

private FirebaseFunctions mFunctions;

public TestClass(){
    mFunctions=new FirebaseFunctions();
}
..

public Task<String> myFunc(String text) {
    // Create the arguments to the callable function, which is just one string
    Map<String, Object> data = new HashMap<>();
    data.put("message", text);

    return mFunctions
            .getHttpsCallable("myFunc")
            .call(data)
            .continueWith(new Continuation<HttpsCallableResult, String>() {
                @Override
                public String then(@NonNull Task<HttpsCallableResult> task) throws Exception {
                    // This continuation runs on either success …
Run Code Online (Sandbox Code Playgroud)

android firebase google-cloud-functions

5
推荐指数
1
解决办法
1236
查看次数

标签 统计

android ×1

firebase ×1

google-cloud-functions ×1