0
我在其中,我與谷歌日曆同步API創建,讀取和刪除使用移動應用程序事件的Android應用程序。當您第一次輸入谷歌帳戶時,它同步沒有問題,但所有這些權限被激活(見圖片)。我只想要有活動日曆的選項,其餘的禁用。我怎樣才能做到這一點?
這是代碼請求的權限:
@AfterPermissionGranted(REQUEST_PERMISSION_GET_ACCOUNTS)
private void selectGoogleAccount(){
if (EasyPermissions.hasPermissions(this, android.Manifest.permission.GET_ACCOUNTS)) {
Intent intent = AccountManager.newChooseAccountIntent(null, null, new String[] { GoogleAccountManager.ACCOUNT_TYPE}, true, null, null, null, null);
startActivityForResult(intent, REQUEST_ACCOUNT_PICKER);
}else {
EasyPermissions.requestPermissions(this, getString(R.string.titleGetUserPermission), REQUEST_PERMISSION_GET_ACCOUNTS, android.Manifest.permission.GET_ACCOUNTS);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}