Android 蓝牙三方和动态权限三方
记录一下最近用到的简单的框架
蓝牙
FastBle:Android BLE通信库的介绍与高级用法 - 简书
https://github.com/Jasonchenlijian/FastBle
动态权限:
GitHub - googlesamples/easypermissions: Simplify Android M system permissions
位置权限举例,arrayOf中多个权限逗号隔开即可
if (ContextCompat.checkSelfPermission(
it,
Manifest.permission.ACCESS_FINE_LOCATION
)
!= PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
it,
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
10001
)
} else {
//权限申请成功,做相应功能
}