android - how to show only timestamp, rssi and mac-address of beacon -


private final threadlocal<scancallback> mscancallback = new threadlocal<scancallback>() {      @override     protected scancallback initialvalue() {         return new scancallback() {             @override             public void onscanresult(int callbacktype, scanresult result) {                 scanrecord btscanrecord = result.getscanrecord();                 //log.i(tag,"new johoksdfjkhdfsj");//not called                 if (btscanrecord != null) {                 }                 connect();                 //log.i(tag,"new johoksdfjkhdfsj");//not called             }              @override             public void onbatchscanresults(list<scanresult> results) {                 (scanresult sr : results) {                     log.i("scanresult-results", sr.tostring());                     //log.i(tag, sr.tostring());//not called                 }             }              @override             public void onscanfailed(int errorcode) {                 log.e("scan failed", "error code: " + errorcode);             }         };     } }; 

i want rssi, timestamp , mac-address think code gives me other string manufacturer details ,advertise flags etc.

try ble scan listener:

 public bluetoothadapter.lescancallback mlescancallback =                 new bluetoothadapter.lescancallback() {              @override             public void onlescan(final bluetoothdevice device, final int rssi, byte[] scanrecord) {                 runonuithread(new runnable() {                     @override                     public void run() {                         // address using                           // device.getaddress();                            adddevice(device,rssi);                              string currentdatetimestring = dateformat.gettimeinstance().format(new date());                          log.e("in h:m:s"," "+currentdatetimestring);                          long tslong = system.currenttimemillis()/1000;                         string ts = tslong.tostring();                         log.e("in miliseconds"," "+ts);                     }                 });             }         }; 

i hope work.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -