缝上蓝牙设置发现模式总是失败 [英] Setting discoverable mode for bluetooth to always on seam to fail
问题描述
我试图将蓝牙可发现
模式总是在的Android 4.0
。这应该是可能的4.0,使用以下命令:
I am trying to set the bluetooth discoverable
mode to always on in Android 4.0
. This should be possible with 4.0, with the command:
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
enableBtIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0);
在执行此之后,我得到询问是否OK总是与discoverybility启动蓝牙的对话框。如果我preSS是蓝牙设置将显示0:00时,它不会倒计时。到目前为止,它看起来不错,但2分钟后蓝牙将再次变为unvisible模式(如previous设置为2分钟)。只有当previous设置总是在意图将工作(通过手动进入蓝牙设置中设置)。
After executing this I get a dialog that asks if it is OK to start bluetooth with discoverybility always on. If I press yes the bluetooth setting will show the time 0:00 and it will NOT countdown. So far it looks fine, but after 2 min the bluetooth will change to unvisible mode again (if the previous setting was 2 min). Only if the previous setting was always on (set by manually going into the bluetooth settings) the Intent will work.
有谁知道更多吗?这是一个bug或者是它是如何应该是什么?如果它不可能由code将设置更改为Always On?
Does anyone know more about this? Is this a bug or is it how it is supposed to be? Should it not be possible to change the setting to always on by code?
推荐答案
一切都没有改变按API文档。 <一href=\"http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#EXTRA_DISCOVERABLE_DURATION\"相对=nofollow>看到这个
Nothing has changed as per the API docs . See this
它默认为120秒,最大值为300秒。
It defaults to 120 seconds and max is 300 seconds
这篇关于缝上蓝牙设置发现模式总是失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!