Welclient/web preview is able to connect to server but live test/apk (installed on mobile) gives "network request failed"

Hi peoples,
Able to connect to the local blynk server using the thunkable web client and web preview . But the downloaded apk mobile app does not connect. Gives the error “network request failed” message on the mobile app and live test. What might be the reason? Because the web client connects successfully. How to debug it?
Suspect it to be a security issue, how to resolve it on mobile app?
Please mention your suggestions? Using webapi’s to connect to the server from thunkable.

1 Like

@mhatreuduyu @fredyfernando We’ll at very least need to see what blocks you are using to connect to help here. Have you checked the documentation for the source as well for these (e.g. Blynk and Microsoft Business Central)?

Yes. Its working with the web preview. Only live test and apk app are failing with “Network request failed” error. followin is my blocks sketch and nothing added to the webapi panel.

I am having this exact issue.

This worked for me:

Web API Error on Android: Network request failed - Questions about Thunkable - Community

Add this to the query parameter:

Content-Type:text/plain

tried this solution but still same results . works with lweb preview but still the same "network request failed " on android.

with web preview:

Did you definitely add it to query parameter?

Of course Matt, I added this query parameter. I am looking to solve this. Every clue towards solving is appreciated. You can suggest all scenarios you have for this. I will test it for each scenario. I suspect it to be some permission issue on android.
Regards

1 Like

waiting for some clues…some work arounds…atleast something to debug this…

Have you tried reaching out to Blynk about this? It does sound like a security or permission issue and I would suspect only Blynk would have a suggestion on what to change in your call to make it work via the Thunkable Live app.

Blynk exposes some web api which I have tested successfully. After testing them I used them in thunkable Web_API control. So that does not seem to be an issue with this.
Anyway, we have got one part working. Maybe I will do the test again if people are feeling confident about this fix. What say?

Hello @mhatreuduyu
To solve this issue you can create a new API using a backend tool and then this API will call the service you are using right now.
You could use a backend service such as Xano or Firebase.
These services have been known to work well with Thunkable’s app

Do you mean a firebase function in cloud that would call webapi provided by blynk…? Ok a thunkable app on android would make a call to firebase cloud function which would call a blynk http web api…is the flow correct?

Hello @mhatreuduyu Yes, that’s exactly what I mean.
Let us know if you need help with the implementation

Hey Thanks ioannis…looks like we are getting closer to the solution. It probably needs some minimal credits to create a backend function…

1 Like

Hey ioannis
Require some guidance on how to call a firebase cloud function from thunkable app…some reading material woul help…
I have been able to create a firebase project and add my mobile app to it, but unable to deploy function to it due to probably credit limits.
Thanks in advance

to deploy functions you need a billing account associated to your firebase account and be on the blaze plan or higher.

firebase cloud functions will be written in JS/TS/Python and will be executed by calling their trigger endpoint via the API blocks.

triggers can be found by going to console.cloud.google.com
search for functions
click cloud functions
click the named function in the list
click the trigger tab
copy paste the trigger URL into your app.

be mindful you’ll either need to use an auth key, api key, or allow your funciton to be invoked by allUsers. be sure to take care of permissions

1 Like

Thanks Jared. Short and very useful info.
on my side only this part is pending.

1 Like