Package com.medm.devicekit
Class MedMScanner
java.lang.Object
com.medm.devicekit.MedMScanner
MedM Scanner is where you search Bluetooth environment for new devices.
-
Method Summary
Modifier and TypeMethodDescriptionsetCallback
(IScannerCallback callback) setErrorCallback
(IErrorCallback callback) start()
Start scan for bluetooth devices.start
(IScannerCallback callback) Deprecated.
-
Method Details
-
setCallback
- Parameters:
callback
- callback to receive discovered devices or notification that discovery was finished- Returns:
- this scanner instance
-
setErrorCallback
- Parameters:
callback
- callback to receive errors- Returns:
- this scanner instance
-
start
Start scan for bluetooth devices. Note that scanner will not filter already found devices. Bluetooth scan requires ACCESS_COARSE_LOCATION on Android 6-11, ACCESS_FINE_LOCATION on Android 10-11, and ACCESS_BACKGROUND_LOCATION if the app is currently in the background on Android 10-11. It also requires location services to be enabled on Android 6-11. On Android 12+ it requires BLUETOOTH_SCAN permission. The SDK also needs BLUETOOTH_CONNECT, so it's a good idea to request both at the same time. If some of required permissions aren't grantedIErrorCallback.onPermissionsRequired(NotEnoughPermissionsException)
is called.- Returns:
- token to stop scanning for devices
-
start
Deprecated.UsesetCallback(IScannerCallback)
andstart()
insteadStart scan for bluetooth devices. Note that scanner will not filter already found devices. Bluetooth scan requires ACCESS_COARSE_LOCATION on Android 6-11, ACCESS_FINE_LOCATION on Android 10-11, and ACCESS_BACKGROUND_LOCATION if the app is currently in the background on Android 10-11. It also requires location services to be enabled on Android 6-11. On Android 12+ it requires BLUETOOTH_SCAN permission. The SDK also needs BLUETOOTH_CONNECT, so it's a good idea to request both at the same time.- Parameters:
callback
- callback to receive discovered devices or notification that discovery was finished- Returns:
- token to stop scanning for devices
-
setCallback(IScannerCallback)
andstart()
instead