Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / SendHTTPRequest() issue on android

Author
Message
nicola316
User Offline
Joined: 6th Jan 2018
Location:
Posted: 7th Jan 2018 00:21
Hi guys,
I'm tryng to make a simple app which can read and write data to a google sheet.
To do that I pass some parameters to a google script using SendHTTPResponse and adding a query string to the URL, then the Google Script makes some stuff with the google sheet and sends a response.
The app works perfectly running on windows, but, when I broadcast it or install via apk, the app doesn't communicate with the Google Script and doesn't return any error.

Here is an example code. It should append a row containing the string inserted in the editbox (GS adds timestamp)

AGK code:


GS code (javascript):


All the code is ready to run. You can copy AppGameKit code and directly try it with no need for changes because the GS and the sheet are public.
This is the link of the sheet: https://docs.google.com/spreadsheets/d/10ZAvMDI6OvTBw9qHnCsF2a6qbV8dGUMgj6HkEIDZNDQ/edit#gid=0

I also tried to use SendHTTPRequest() and to set SetHTTPHost() HTTPS secure connection but nothing changes.
Posting var$ using SendHTTPRequest(http, GScriptURL$, var$) doesn't work neither on windows nor on android.

Am I doing it right? Any suggestion?

Thanks.
nicola316
User Offline
Joined: 6th Jan 2018
Location:
Posted: 9th Jan 2018 19:55
Initially I thought there was something wrong with device settings so I tried different smartphones: Huawei p8 lite, Huawei p9 lite, Huawei Y530U00 and Meizu M2. Nothing changed, so I think this hypothesis can be exluded.
I've written this code to try some URL directly from devices.



First editbox is used to set the host, the second one is used for the request fiunction.
Doing some tests, I confirmed device settings aren't the problem.
The only host that doesn't work on mobile (but work on windows) seems to be script.google.com.
How can i fix that?
nicola316
User Offline
Joined: 6th Jan 2018
Location:
Posted: 12th Jan 2018 23:09
Solved!
By default HTTP Verify Certificate is on, and connection to google script fails because agk doesn't recognise a valid certificate.
(As written in agk documentation "If the server you are connecting to is using a self signed certificate you will need to set this to 0 or the connection will fail.")
Setting HTTP Verify Certificate to 0, everything works perfectly as it does on windows.

Login to post a reply

Server time is: 2018-09-22 13:02:37
Your offset time is: 2018-09-22 13:02:37