public class BluetoothEnabler extends Object
Build.VERSION_CODES.M
.
With Build.VERSION_CODES.M
you need to have Manifest.permission.ACCESS_COARSE_LOCATION
or Manifest.permission.ACCESS_FINE_LOCATION
in your AndroidManifest.xml, and also enable them at runtime, AND also make sure location services are on.
BleManager
(see the "See Also" section, which has enough links that it might give you
an idea of why BluetoothEnabler
was written). As such you don't need to use it, but in combination with BluetoothEnabler.DefaultBluetoothEnablerFilter
it comes in handy as a one-line addition to most simple apps.BleManager.isLocationEnabledForScanning()
,
BleManager.isLocationEnabledForScanning_byManifestPermissions()
,
BleManager.isLocationEnabledForScanning_byRuntimePermissions()
,
BleManager.isLocationEnabledForScanning_byOsServices()
,
BleManager.turnOnLocationWithIntent_forPermissions(Activity, int)
,
BleManager.turnOnLocationWithIntent_forOsServices(Activity, int)
,
BleManager.turnOnWithIntent(Activity, int)
,
BleManager.willLocationPermissionSystemDialogBeShown(Activity)
,
https://github.com/iDevicesInc/SweetBlue/wiki/Android-BLE-Issues#android-m-issuesModifier and Type | Class and Description |
---|---|
static interface |
BluetoothEnabler.BluetoothEnablerFilter
Provide an implementation to
BluetoothEnabler(Activity, BluetoothEnablerFilter) to receive callbacks or simply use the provided class
BluetoothEnabler.DefaultBluetoothEnablerFilter by calling start(Activity) . |
static class |
BluetoothEnabler.DefaultBluetoothEnablerFilter
A default implementation of BluetoothEnablerListener used in
start(Activity) . |
public static BluetoothEnabler start(Context context)
public static BluetoothEnabler start(Context context, BluetoothEnabler.BluetoothEnablerFilter filter)
public static void resume_static(BluetoothEnabler.BluetoothEnablerFilter.Please please)
resume(BluetoothEnablerFilter.Please)
that you can use to call down into the
singleton created by start(Activity, BluetoothEnablerFilter)
(or overloads).public static void onActivityOrPermissionResult_static(int requestCode)
onActivityOrPermissionResult(int)
that you can use to call down into the
singleton created by start(Activity, BluetoothEnablerFilter)
(or overloads).public static BluetoothEnabler start(Activity activity)
start(Activity, BluetoothEnablerFilter)
that uses an instance of BluetoothEnabler.DefaultBluetoothEnablerFilter
.public static BluetoothEnabler start(Activity activity, BluetoothEnabler.BluetoothEnablerFilter filter)
Build.VERSION_CODES.M
.public void onActivityOrPermissionResult(int requestCode)
Activity.onRequestPermissionsResult(int, String[], int[])
and Activity.onActivityResult(int, int, Intent)
methods.
This method will re-connect the enabler after the app is re-entered. Otherwise, the enabler won't continue unless BluetoothEnabler.BluetoothEnablerFilter.Please.withImplicitActivityResultHandling()
is called.public boolean isEnabled(BluetoothEnabler.BluetoothEnablerFilter.Stage stage)
BluetoothEnabler.BluetoothEnablerFilter.Stage
has been enabled.public void resume(BluetoothEnabler.BluetoothEnablerFilter.Please please)
public BluetoothEnabler.BluetoothEnablerFilter.Stage getStage()
BluetoothEnabler.BluetoothEnablerFilter.Stage
the enabler is onpublic boolean isPerformingSystemCall()
public boolean isDone()