From 1acdcc1a508c00dc31751a2a2eef539a59cb21ce Mon Sep 17 00:00:00 2001 From: Nick Pelly Date: Mon, 28 Sep 2009 10:33:55 -0700 Subject: [PATCH] Add an API to request a system activity to turn on Bluetooth. Change-Id: I2fca33ad27017ea4e2ecba37854b749682d07672 --- api/current.xml | 11 ++++++++++ .../android/bluetooth/BluetoothAdapter.java | 22 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/api/current.xml b/api/current.xml index d8ab697f31a43..ef27dafbeed75 100644 --- a/api/current.xml +++ b/api/current.xml @@ -26029,6 +26029,17 @@ visibility="public" > + + This activity will also request the user to turn on Bluetooth if it + * is not currently enabled. *

Discoverable mode is equivalent to {@link * #SCAN_MODE_CONNECTABLE_DISCOVERABLE}. It allows remote devices to see * this Bluetooth adapter when they perform a discovery. @@ -120,7 +122,7 @@ public final class BluetoothAdapter { * value if the user rejected discoverability. *

Applications can also listen for {@link #ACTION_SCAN_MODE_CHANGED} * for global notification whenever the scan mode changes. - *

Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} + *

Requires {@link android.Manifest.permission#BLUETOOTH} */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_REQUEST_DISCOVERABLE = @@ -135,6 +137,24 @@ public final class BluetoothAdapter { public static final String EXTRA_DISCOVERABLE_DURATION = "android.bluetooth.adapter.extra.DISCOVERABLE_DURATION"; + /** + * Activity Action: Show a system activity that allows the user to turn on + * Bluetooth. + *

This system activity will return once Bluetooth has completed turning + * on, or the user has decided not to turn Bluetooth on. + *

Notification of the result of this activity is posted using the + * {@link android.app.Activity#onActivityResult} callback. The + * resultCode + * will be negative if the user did not turn on Bluetooth, and non-negative + * if Bluetooth has been turned on. + *

Applications can also listen for {@link #ACTION_STATE_CHANGED} + * for global notification whenever Bluetooth is turned on or off. + *

Requires {@link android.Manifest.permission#BLUETOOTH} + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_REQUEST_ENABLE = + "android.bluetooth.adapter.action.REQUEST_ENABLE"; + /** * Broadcast Action: Indicates the Bluetooth scan mode of the local Adapter * has changed.