0
Post Request from Android client to Flask server
Hello, I've been trying in many ways to send a simple post request from my Android client (programmed in Java) to my Flask server. The Android app runs on a mobile phone, and the Flask server on another laptop on the LAN. I gave INTERNET permission in the AndroidManifest and made this method for posting a post request, why doesn't it work? I get no exceptional exceptions in the Logcat btw. I've also found that the error probably occurs at the first line inside the "try" block. https://code.sololearn.com/ca3s7bHIdIoY/?ref=app
5 Respostas
+ 1
Once check your base url it's correct. And also check required params are you correct headers verify api
use debugger check api response
+ 1
Do u have ssl if not have you allowed permission
+ 1
What u getting in response while hitting api use debugger check line by line
0
AS Raghuvanshi I used postman with the exact same parameters and it worked. I think there might be something blocking my request, it might be the phone that is not letting traffic out, or my laptop's firewall - I'm not sure.
0
AS Raghuvanshi I set up a normal Flask server, nothing too complex... didn't use SSL, but I gave INTERNET permission for the Android, and set up "host='0.0.0.0'" in the flask server.
When using postman, I get the desired response. But, the postman is on the same machine as the Flask server, and it's not code on Android.