Android 10.0 开发BLE
权限声明
<!-- 蓝牙权限 -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Android 5.0以上蓝牙好需要位置权限 -->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- android 10权限 并动态申请 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
权限申请
//授权权限
ActivityCompat.requestPermissions(activity,new String[]{
Manifest.permission.INTERNET,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.WAKE_LOCK},1);