【发布时间】:2017-07-09 17:36:35
【问题描述】:
我的蓝牙权限有问题。我在清单中声明了以下几行:
<permission android:name="android.permission.BLUETOOTH" android:label="BLUETOOTH" />
<permission android:name="android.permission.BLUETOOTH_ADMIN" />
奇怪的是,在应用设置而不是蓝牙中,我有权添加位置和存储权限。但是好的,可以说android没有为蓝牙提供特定的perms,这些与BT相同。奇怪的是,即使我没有给应用程序任何权限(不是为了内存,不是为了本地化),也可以使用以下代码:
int permissionCheck = ContextCompat.checkSelfPermission(this,
Manifest.permission.BLUETOOTH_ADMIN);
if(permissionCheck == PackageManager.PERMISSION_GRANTED){
Toast.makeText(this, "granted", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "not granted :(", Toast.LENGTH_SHORT).show();
}
我仍然收到已授予权限的消息。有没有搞错?我应该专门检查 EXTERNAL_STORAGE 和 Location 权限吗?为什么蓝牙没有显示在应用权限配置中?
【问题讨论】:
标签: android bluetooth permissions manifest