0
Inside an android application, I have a screen that requires bluetooth to be enabled, if it is disabled, the part of the code below asks the user to enable it:
final BluetoothManager bluetoothManager =
(BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter();
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
((MainActivity) context).startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
Until then beauty, when bluetooth is disabled, appears the native screen of Android asking to enable it
"The app is requesting permission to activate Bluetooth. Allow?"
If the user press "YES" it enables bluetooth, however, I did not find how to treat if the user press "NO".