參考連接:
https://stackoverflow.com/questions/52079343/how-can-i-use-adb-to-grant-permission-without-root
eg:
授予權限命令:
adb -d shell pm grant package android.permission.CAMERA
移除權限命令:
adb -d shell pm revoke package android.permission.CAMERA
有可能發生的問題:
無法獲取權限,並報錯:Security exception: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
問題原因:
有些具有侵略性的權限無法直接被申請,但是一般手機有個設置可以規避這個問題,以realMe為例
解決方法:
realme:打開禁止權限監控
華為手機暫時未發現此項設置,但是可以直接使用
腦殘小米不插sim卡無法打開USB調試,醉了