适配 Android 12 及以上蓝牙权限模型变更#488
Merged
SuperMonster003 merged 1 commit intoSuperMonster003:masterfrom Mar 3, 2026
Merged
Conversation
Closed
Contributor
Author
|
需要APK者可以在這裡下載 https://github.com/Willie169/AutoJs6/releases/tag/v6.6.5。 |
Owner
|
感谢提交 PR. 有两个需要修改的地方, 已保证合并代码后不会产生副作用. 1.
|
Contributor
Author
|
已 restore 該等檔案的變更並 ammend 到 commit 上。感謝您開發與維護這個偉大的專案。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
根据 https://developer.android.com/develop/connectivity/bluetooth/bt-permissions:
原本的 AutoJs6 在 manifest 中未声明 BLUETOOTH_CONNECT、BLUETOOTH_SCAN 与 BLUETOOTH_ADVERTISE 权限,故无法在 Android 12 及以上的装置使用需要该等权限的功能。
解决方案
在 manifest 中声明 BLUETOOTH_CONNECT、BLUETOOTH_SCAN 与 BLUETOOTH_ADVERTISE 权限以适配 Android 12 及以上蓝牙权限模型变更。
验证
在 Android 14 真机上测试,通过 runtime.requestPermissions 请求权限后可正常使用需要该等权限的功能。