简体   繁体   中英

How to Set Bluetooth device Discovery Timeout to 1 hour(3600) seconds and Never Time out in android

I am working on Bluetooth App where I want to add the functionality of Manually configuring the Discoverable Timeout Period.When i set DISOVERABLE_DURATION to 120 or 300 it works fine.However it does not provide any response in onActivityResult() when i set it to 3600 seconds.

Similarly I have set DISOVERABLE_DURATION to 0 for Never Time out which not working too.

I have Searched a lot and found that similar Bugs were reported but i could not be able to Find an appropriate Solution.

I am firing the following Intent

Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,DISOVERABLE_DURATION);
startActivityForResult(discoverableIntent,REQUEST_DISCOVERABLE_BT);

Please provide me an appropriate Solution../

making discoverable forever -

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

a value of 0 means the device is always discoverable.

I know, this was posted 2 months back. But there was no answer anyway, so i just thought of replying. :) Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM