Starting the bluetooth Scan
note
This snippet of the code explains how to start the Bluetooth scan. Without this step,you won't be able to access the doors to which.
AccessManager accessManager = serviceProvider.getAccessManager();
accessManager.startBleScan();
// Make sure bluetooth is turned on.
// For android 6.0 and above ACCESS_COARSE_LOCATION or
ACCESS_FINE_LOCATION permission is required
and location (network mode) is to be turned on.
// This is a mandate required by android since a person's location can be
determined if the gps
location of nearby ble devices are known.
// Since these actions require user interactions it is left to the client
to implement it.
// For android 10.0 and above ACCESS_FINE_LOCATION permission is required.
// For android 11.0 and above ACCESS_BACKGROUND_LOCATION permission is
necessary for background
access (proximity/tap to access/gesture unlock) to work.
//To observe on the scanned devices an androidx live data object is
exposed by the sdk
LiveData<List<AccessPointBleDevice>> liveData =
accessManager.getScannedDevicesLiveData();
//The list is ordered such that closest device is at the top.
//If devices are nearby
class AccessPointBleDevice {
String accessPointId;
//id of the access point the device is attached to
String tag;
//tag of the device(entry/exit) for the access point
boolean supportsCalibration;
//Wether the device allows mobile calibration on itself
int rssi;
//The last known signal strength of the device as measured by the phone.
//(Higher the value, closer the device)
}
info
Additional checks
- For Android, Make sure the bluetooth is turned on
- For android 6.0 and above ACCESS_COARSE_LOCATION permission is required and location (network mode) is to be turned on.