Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
159 views
in Technique[技术] by (71.8m points)

android - Problem with triggering Firestore function from mobile app client

I'm new to Android development, and am encountering a problem while working with Google Cloud functions:

{
"userId":"firestore_generated_user_id",
"telephone": "0101010101",
"email": "[email protected]",
"addresses" : [{
 "country": "Brasil",
 "city": "San Hose",
 "street": "Rose Ave",
 "number": "12",
 "еntrance" : "1",
 "floor": "2",
 "apartment": "3",
 "disabled" : false
}]
}

I created a class for "addresses", and then:

val addressForFirestoreFunction = Addresse("15", "San Hose", "Brasil", false, "5", "10", "Rose Ave", "")

after that i put my addressForFirestoreFunction to arraylist :

var adresses = ArrayList<Addresse>()
adresses.add(addressForFirestoreFunction)

After that I create a map:

val adressForFunction = mapOf(
            "userId" to "firestore_generated_user_id",
            "telephone" to "0877080792",
            "email" to "[email protected]",
            "addresses" to adresses
        )

Then finally trigger the function:

functions
            .getHttpsCallable("addAddress")
            .call(adressForFunction)
            .continueWith { task ->
                val result = task.result?.data as String
                Log.e("tag",result.toString())
                result
            }

In logs of firestore functions - nothing happens, absolutely. When i trigger the function with empty:

.call()

In the logs I can see that function was invoked, but shortly after that it crashes. When making the request in Postman everything works well.

I'm really out of ideas here, and would appreciate any suggestions from the community in solving this problem. Thank you.

question from:https://stackoverflow.com/questions/65845071/problem-with-triggering-firestore-function-from-mobile-app-client

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...