Wednesday, January 24, 2018

Read bluetooth device rssi without connected them starscan() issue

Leave a Comment

I read this Issue.

I want to make one sample app to read the all BLE device rssi near of my application range without connecting them.

I create STICKY service & access near device scan result.

BluetoothManager mBluetoothManager = (BluetoothManager) getSystemService(SmartIDService.this.BLUETOOTH_SERVICE);         mBluetoothAdapter = mBluetoothManager.getAdapter();  //Start Scan. mBluetoothAdapter.startLeScan(mLeScanCallback);  //Listen scan Resul. private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback()     {          @Override public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord)         {                        AppLogger.showDebugLog(TAG + "rssi: " +rssi);          }     };  

I got the result as I want,but if BLE device out of range for some time I can't get the result again. I think that startLeScan() is remove from memory, so I create One alarm service to wakt up mBluetoothAdapter.startLeScan(mLeScanCallback); some time interval & issue is resolved. But I can't find the actual time interval that I will wake up alaram service.

any solution !!!
idea time interval for every device?
Any other process?

please guide me

1 Answers

Answers 1

Can you check this Github code, I have used once in my project and it worked perfectly.

https://github.com/googlesamples/android-BluetoothLeGatt

let me know if it won't work.

Thanks Madhav

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment