检测“蓝牙扫描定位”是否已打开

经过大量的搜索,我终于找到了一种了解状态的方法:

try {

ContentResolver resolver = getApplicationContext().getContentResolver();

int result = Settings.Global.getInt(resolver,"ble_scan_always_enabled");

if(result == 1) {

// Bluetooth scanning is on

} else {

// Bluetooth scanning is off

}

} catch(SettingNotFoundException e) {

// Settings doesn't exist, on Android < 6

}

您可以使用"wifi_scan_always_enabled"来获取wifi扫描状态。它不需要任何权限。

如果我找到了重定向用户到屏幕或禁用它的方法,我会更新这篇文章。


赵薇卖的红酒怎么样,赵薇的红酒口感如何?
2025全国最好的大专院校排名!附录取分数线一览表