How to communicate mobile device with BLE
when an application installs in mobile and trying to get other mobile device battery information where ScanCallback does not return any information on searching BLE device
.
private ScanCallback scanCallback = new ScanCallback() {
@Override
public void onScanResult(int callbackType, ScanResult result) {
// super.onScanResult(callbackType, result);
Log.e("scaning result"," :"+result.getDevice().getName());
bluetoothDevice = result.getDevice();
deviceAddress.setText(bluetoothDevice.getAddress());
deviceName.setText(bluetoothDevice.getName());
progressBar.setVisibility(View.INVISIBLE);
}
@Override
public void onBatchScanResults(List<ScanResult> results) {
super.onBatchScanResults(results);
}
@Override
public void onScanFailed(int errorCode) {
super.onScanFailed(errorCode);
Log.d(TAG, "Scanning Failed " + errorCode);
progressBar.setVisibility(View.INVISIBLE);
}
};