我想询问android-permissions。我设法为WRITE_SETTINGS以外的所有内容(包括Cal,SMS,Camera,Internet,Body_sensor等)进行了操作。我的WRITE_SETTINGS权限没有弹出窗口。
我试图只要求WRITE_SETTINGS权限,然后再要求WRITE_SETTINGS权限(首先在globale.PERMS中,首先在buildozer.spec权限列表中,然后将其放在我的AndroidManifest.xml中。工作。
main.py:
def acquire_permissions(self, permissions, timeout=30):
"""
Ask for permissions
"""
PythonActivity = jnius.autoclass('org.kivy.android.PythonActivity')
PythonActivity.requestPermissions(globale.PERMS)
time.sleep(10)
if LoginWindow.all_granted(self, globale.PERMS, PythonActivity) == True:
return True
globale.PERMS:
PERMS = ["android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.CAMERA",
"android.permission.INTERNET",
"android.permission.SEND_SMS",
"android.permission.CALL_PHONE",
"android.permission.WRITE_SETTINGS"]
Buildozer.spec:
android.permissions = INTERNET, CAMERA, SEND_SMS, WRITE_EXTERNAL_STORAGE, CALL_PHONE, READ_EXTERNAL_STORAGE, WRITE_SETTINGS
AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
我应该有一个弹出窗口来询问WRITE_SETTINGS权限,就像其他所有权限一样,但是它没有显示,并且即使在手机上使用python日志,我的日志也没有任何错误。