Get current bluetooth discoverability timeout

I am making an app that requires the user's bluetooth discoverability/visibility timeout to "Never time out".

I use the following code to ask the user to change the current settings.

Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0);           

However, I don't want to bother the user if bluetooth discoverability is already on.

Is there a way to get the device's current discoverability timeout?


You can use the the following:

BluetoothAdapter ba = BluetoothAdapter.getDefaultAdapter();
if (ba.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE)
    //Launch the intent to set timeout

You should also make sure that the Adapter is turned on.

Need Your Help

How do you display big notfications with buttons?

java android statusbar

What I am trying to do is make the big notification with at least one button ( if i'm suppose to have at least 2, i'll accept that).

Dismiss Popover with a Button Done or Cancel on the Popover

ios objective-c uiviewcontroller uipopovercontroller dismiss

I have created 2 ViewControllers, one is called ViewController and the other one catViewController with it's own class. In the ViewController when I press "Category" button in the barbutton, I call...