Banker Mittal
Banker Mittal

Reputation: 1918

bluetooth settings+android

In My Application i Need to check whether the device is discoverable or not and bletooth is on or off I applied the code like this

bluetoothenable=Settings.Secure.getInt(myContext.getContentResolver(),
android.provider.Settings.Secure.BLUETOOTH_ON);

It gives true value when in settings i have checked bluetooth on but for discoverable i add this code

bluetooth=Settings.System.getInt(myContext.getContentResolver(),
android.provider.Settings.System.BLUETOOTH_DISCOVERABILITY);

it gives me Settings not found exception not this any value i check through android.provider.Settings.System it gives this error If we can not read settings value through android.provider.Settings.System?

Upvotes: 0

Views: 886

Answers (1)

7heViking
7heViking

Reputation: 7577

You can set up a BluetoothAdapter. With this adapter you can get isEnabled() and getScanMode()

Upvotes: 1

Related Questions