1

只有當用戶啓用某個偏好時,纔有辦法請求特定權限嗎?Android偏好特定權限請求

在我的情況下,我可以選擇與日曆同步來添加日期和設置提醒(據我所知,您不能在具有意圖的日曆中設置提醒)。顯然,我需要訪問日曆的權限,但只有在用戶啓用此選項時纔有效。我希望在用戶啓用首選項時請求權限,然後在未授予權限的情況下禁用該選項。

回答

2

不幸的是,沒有辦法做到這一點。

No checks with the user are done while an application is running: it either was granted a particular permission when installed, and can use that feature as desired, or the permission was not granted and any attempt to use the feature will fail without prompting the user.

http://developer.android.com/guide/topics/security/permissions.html