c++ Console application connection to android app -


i have make connection between android app , c++ console application: console application suppose client side has 4 commands data server android device. in other words need display device info (bt/wifi on/off, battery lvl) in console application.

i created client side , have code things have check(if bt on example). thing i'm missing connection between these, have no experience in server code, , need this, how done or links tutorials cause didn't find some.

the android code:

  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      //imei init     telephonymanager telephonymanager = (telephonymanager) getsystemservice(context.telephony_service);     imei = telephonymanager.getdeviceid();      //software version init     packageinfo pinfo = null;     try {         pinfo = getpackagemanager().getpackageinfo(getpackagename(), 0);     } catch (packagemanager.namenotfoundexception e) {         e.printstacktrace();     }     int softwareversion = pinfo.versioncode;       //battery lvl init     battery = library.getbatterylevel(this);      //android id init     android_id = secure.getstring(this.getcontentresolver(),             secure.android_id);      //android availability init     internetaval = library.isnetworkavailable(this);      //finish init  <<~~         textview tv = (textview) findviewbyid(r.id.tv1);     tv.settext(" " + internetaval);      library.setwifi(this,false);   } 

although question broad , subject being closed, give overlook clue implemented.

using java network apis (socket programming) should pick port number , start listening on. key thing here android device , computer running c++ app must connected same network (for example wlan or lan).

in case both devices assigned 2 unique ip address, can set them manually.

in client side (c++), should create tcp socket , connect ip address of android device given port number. so, using way can connect c++ java server running in android app. in other side, should accept incoming connects in android app using java socket apis.

suggestion: never create apps scratch, use well-known libraries. makes development process more quicker , more enjoyable. :)


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -