android app to connect raspberry pi via bluetooth -


i trying connect raspberry pi 3 bluetooth smartphone using android control sensor. new android development

but, not able connect bluetooth. have fragment bluetooth connection shown below. when open app , turn on bluetooth able see list of available device , when try connect not connecting. , not getting errors. please me. thanks

private class connectthread extends thread {          private final bluetoothsocket mmsocket;         private final bluetoothdevice mmdevice;          public connectthread(bluetoothdevice device) {             // use temporary object later assigned mmsocket,             // because mmsocket final             bluetoothsocket tmp = null;             mmdevice = device;             log.i(tag, "construct");             // bluetoothsocket connect given bluetoothdevice             try {                 // my_uuid app's uuid string, used server code                 tmp = device.createrfcommsockettoservicerecord(my_uuid);             } catch (ioexception e) {                 log.i(tag, "get socket failed");              }             mmsocket = tmp;         }          public void run() {             // cancel discovery because slow down connection             bluetoothadapter.canceldiscovery();             log.i(tag, "connect - run");             try {                 // connect device through socket. block                 // until succeeds or throws exception                 mmsocket.connect();                 log.i(tag, "connect - succeeded");             } catch (ioexception connectexception) {    log.i(tag, "connect failed");                 // unable connect; close socket , out                 try {                     mmsocket.close();                 } catch (ioexception closeexception) { }                 return;             }              // work manage connection (in separate thread)              mhandler.obtainmessage(success_connect, mmsocket).sendtotarget();         }            /** cancel in-progress connection, , close socket */         public void cancel() {             try {                 mmsocket.close();             } catch (ioexception e) { }         }     } 

logcat:

06-11 12:42:42.366 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: onactivitycreated 06-11 12:42:42.368 24775-24775/pratik.prajapati.rpicontrol d/bluetoothadapter: 592452976: getstate() :  mservice = null. returning state_off 06-11 12:42:42.368 24775-24775/pratik.prajapati.rpicontrol d/bluetoothadapter: 592452976: getstate() :  mservice = null. returning state_off 06-11 12:42:44.242 24775-24775/pratik.prajapati.rpicontrol d/bluetoothadapter: 592452976: getstate() :  mservice = null. returning state_off 06-11 12:42:44.242 24775-24775/pratik.prajapati.rpicontrol d/bluetoothadapter: 592452976: getstate() :  mservice = null. returning state_off 06-11 12:42:44.569 24775-24775/pratik.prajapati.rpicontrol w/inputmethodmanager: startinputinner : inputbindresult == null 06-11 12:42:46.671 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: broadcastreceiver 06-11 12:42:46.672 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: action_discovery_started 06-11 12:42:46.672 24775-24775/pratik.prajapati.rpicontrol i/timeline: timeline: activity_idle id: android.os.binderproxy@1f4b7828 time:54694433 06-11 12:42:54.474 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: broadcastreceiver 06-11 12:42:54.476 24775-24775/pratik.prajapati.rpicontrol d/bluetoothdevice: getservice : register callback 06-11 12:42:54.481 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: new device found : wasi (unpaired)                                                                                                                          60:36:dd:56:00:44 06-11 12:43:12.396 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: broadcastreceiver 06-11 12:43:12.400 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: new device found : desktop-36ah3d9 (unpaired)                                                                                                                          60:6c:66:8b:b7:57 06-11 12:43:13.228 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: broadcastreceiver 06-11 12:43:13.229 24775-24775/pratik.prajapati.rpicontrol d/bluetooth_fragment : debug ==============================>: action_discovery_finished 06-11 12:43:21.046 24775-24775/pratik.prajapati.rpicontrol i/bluetooth_fragment : debug ==============================>: construct 06-11 12:43:21.054 24775-26477/pratik.prajapati.rpicontrol i/bluetooth_fragment : debug ==============================>: connect - run 06-11 12:43:21.054 24775-26477/pratik.prajapati.rpicontrol w/bluetoothadapter: getbluetoothservice() called no bluetoothmanagercallback 06-11 12:43:33.273 24775-26477/pratik.prajapati.rpicontrol i/bluetooth_fragment : debug ==============================>: connect failed  

please find project here


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -