在我的应用程序中,我需要检查设备是否可发现,以及bletooth是否打开或关闭。我应用了如下代码
bluetoothenable=Settings.Secure.getInt(myContext.getContentResolver(),
android.provider.Settings.Secure.BLUETOOTH_ON);当我在设置中选中蓝牙时,它会给出真实值,但对于discoverable,我会添加以下代码
bluetooth=Settings.System.getInt(myContext.getContentResolver(),
android.provider.Settings.System.BLUETOOTH_DISCOVERABILITY);如果无法通过android.provider.Settings.System读取设置值,它会显示未找到设置异常,而不是我通过android.provider.Settings.System检查的任何值
发布于 2012-07-25 23:15:16
您可以设置BluetoothAdapter。使用这个适配器,您可以获得isEnabled()和getScanMode()
https://stackoverflow.com/questions/8257138
复制相似问题