Android - Reading Http Request
I'm doing a project with Arduino and Android application. Here's how it goes, send from the application request 'a=11&b=22&d=33' (http://192.168.0.17/?a=11&b=22&d=3
Solution 1:
You have 2 options:
Poll the server: write a function on the server that returns the results you need. Then setup a timer in android that calls this function every few seconds
Push messages from the server: use a push service to send your results to the android app. ex: https://firebase.google.com/docs/cloud-messaging/
To parse your server response string:
String serverResponse = "?a=11&b=22&d=33";
String[] args = serverResponse.substring(1).split("&");
String a = args[0].split("=")[1];
String b = args[1].split("=")[1];
String c = args[2].split("=")[1];
Post a Comment for "Android - Reading Http Request"