node.js - Stream Data to Website from Android device -
for project stream sensor data of accelerometer (from android phone) website.
basically have written application reads data , stores on phone , converts string. want plot x, y , z values line graph dynamically on website. if shake phone, line on website should moving.
i had several ideas using node.js or java webserver couldn't found appropriate tutorials. maybe got idea find tutorials, can learn how stream data website phone. should easy or not hard not in making webservers or so.
keep sending data server ideally making post request.
your webserver can read data obtained requests , update graph.
how write server ? go through below link http://tutorials.jenkov.com/java-multithreaded-servers/singlethreaded-server.html how post data android ? use async task doing below things
public void postdata() { // create new httpclient , post header httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://www.server.com/"); try { // add data list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(1); namevaluepairs.add(new basicnamevaluepair("graphvalue", "12345")); httppost.setentity(new urlencodedformentity(namevaluepairs)); // execute http post request httpresponse response = httpclient.execute(httppost); } catch (clientprotocolexception e) { // todo auto-generated catch block } catch (ioexception e) { // todo auto-generated catch block }
}
Comments
Post a Comment