使蓝牙可发现

问题描述:

我想使蓝牙可发现,有没有办法,并且android允许我的应用程序执行此操作?使蓝牙可发现

我找到了这个链接,但我不知道该怎么做。

[http://developer.android.com/reference/android/provider/Settings.System.html#BLUETOOTH_DISCOVERABILITY][1] 

通过这个代码的设备将发现的300秒

if (mBluetoothAdapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) { 
     Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); 
     discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); 
     startActivity(discoverableIntent); 
    }