mysql - how to access string sent from wearable tizen app to android app -


a bit of background: using samsung gear 2, samsung s4 ,eclipse , tizen ide wearable.

i have app on both devices communicates using accessory sdk. on same app, have codes read heartrate. pass heartrate wear app using sasocket.senddata on code below. access string on android app using onrecieve method on shown below.

now, want save heartrate in mysql. how can access string , save mysql?

 try {         sasocket.setdatareceivelistener(onreceive);         sasocket.senddata(channelid,heartrate.tostring());      } catch(err) {         console.log("exception [" + err.name + "] msg[" + err.message + "]");     }      @override     public void onreceive(int channelid, byte[] data) {         log.d(tag, "onreceive");          time time = new time();          time.set(system.currenttimemillis());          string timestr = " " + string.valueof(time.minute) + ":"                 + string.valueof(time.second);          string strtoupdateui = new string(data);         system.out.println("strtoupdateui : " + strtoupdateui);         heartrate =strtoupdateui;         final string message = strtoupdateui.concat(timestr);          final helloaccessoryproviderconnection uhandler = mconnectionsmap.get(integer                 .parseint(string.valueof(mconnectionid)));         if(uhandler == null){             log.e(tag,"error, can not helloaccessoryproviderconnection handler");             return;         }         new thread(new runnable() {             public void run() {                 try {                     uhandler.send(helloaccessory_channel_id, message.getbytes());                 } catch (ioexception e) {                     e.printstacktrace();                 }             }         }).start();     } 

first of, great have come far in gear app development i.e getting provider , consume side apps communicate. of hardwork done. assume have heartrate data in heartrate variable heartrate =strtoupdateui;

what can next create method "saves" data . following steps might help.

  1. create mysql data base , details. can download wamp , install on local machine
  2. create database , table hold heartreate data
  3. your android code might not able directly save data mysql database, need write web application (a simple mysqlhandler) written in dynamic web app dev language of choice this.
  4. from android code, make web request , post heartrate data mysql web handler inserts data mysql.

there tutorial on how build phpbased mysql handler here , save data android. refer stackoverflow answer .

v.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -