禁止在Android蓝牙发现模式 [英] Disable Bluetooth discoverable mode on Android

查看:194
本文介绍了禁止在Android蓝牙发现模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现Android的文件怎么打开蓝牙可发现模式:

I found in the Android documentation how to turn Bluetooth discoverability mode on:

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

这将会使设备可发现300秒(<一href="http://developer.android.com/guide/topics/wireless/bluetooth.html#EnablingDiscoverability">documentation).

This will make the device discoverable for 300 seconds (documentation).

我的问题是:如何把可发现关超时发生过吗?我想复制中设置相应的设置|无线和网络|蓝牙设置小程序,它允许可发现被打开和关闭与开启点击

My question is: how to turn discoverability OFF before this timeout occurs? I'd like to replicate the corresponding setting in Settings|Wireless and networks|Bluetooth settings applet, that allows discoverability to be turned on and off with a click.

任何帮助吗?

感谢;)

推荐答案

只需发送与持续时间1(或0甚至可能工作)新发现的请求:

Just send a new discoverable request with duration 1 (or 0 might even work):

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

这篇关于禁止在Android蓝牙发现模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆