我正在开发一个小SDK,它必须通过.aar文件包含在项目中。在这个sdk中,我定义了如下方法:
python -m pip install pyodbc
如您所见,该方法带有/**
* Sends an "open lock" request for the bike, with the ble name provided as param. Requires ACCESS_FINE_LOCATION and
* BLUETOOTH permission
*
* @param bikeBleName The BLE name of the searched bike, normally starts with 'BS' prefix
* @param listener Listener for the operation state, returns success or an error string with the detailed error
*/
@RequiresPermission(allOf = [Manifest.permission.BLUETOOTH, Manifest.permission.ACCESS_FINE_LOCATION])
override fun startRent(bikeBleName: String, bikeMode: BikeMode, listener: StartRentListener) {
GlobalScope.launch {
startRentManager.startRent(bikeBleName, bikeMode, listener)
}
}
注释,但是,如果我从项目MainActivity调用该方法,则Android Studio会告诉我该方法需要权限检查,但不会告诉我需要哪些权限。
我想获得的是Android Studio告诉我“此方法需要ACCESS_FINE_LOCATION和BLUETOOTH权限”,与下面的屏幕快照类似。我该如何实现?谢谢
库模块的清单文件为:
@RequiresPermission(allOf = [Manifest.permission.BLUETOOTH, Manifest.permission.ACCESS_FINE_LOCATION])
答案 0 :(得分:1)
问题是我放置了
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.zehus.bikeaccesssdk">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
</manifest>
库模块中的。我从库清单中删除了权限,现在Android Studio提供了正确的提示。