一、检测是否已允许权限
二、申请未允许权限
三、处理请求权限结果
四、再次提醒用户允许权限
亲手实验:
1、第一次申请这个危险权限,isTip为false
2、被拒绝一次后,isTip为true
3、不屏蔽也不同意权限的申请,isTip为true
4、屏蔽申请该权限的提示框,isTip为false
实验结果:
True:用户在拒绝过应用申请危险权限以及没有屏蔽权限申请提示框
False:应用以前从未申请过危险权限以及用户屏蔽这个危险权限的申请
五、跳转到系统权限设置页
Intent intent =new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", mContext.getPackageName(), null);
intent.setData(uri);
mContext.startActivity(intent);
六、常见危险权限
1、android.permission-group.CALENDAR
android.permission.READ_CALENDAR
android.permission.WRITE_CALENDAR
2、android.permission-group.CAMERA
android.permission.CAMERA
3、android.permission-group.CONTACTS
android.permission.READ_CONTACTS
android.permission.WRITE_CONTACTS
android.permission.GET_ACCOUNTS
4、android.permission-group.LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_COARSE_LOCATION
5、android.permission-group.MICROPHONE
android.permission.RECORD_AUDIO
6、android.permission-group.PHONE
android.permission.READ_PHONE_STATE
android.permission.CALL_PHONE
android.permission.READ_CALL_LOG
android.permission.WRITE_CALL_LOG
com.android.voicemail.permission.ADD_VOICEMAIL
android.permission.USE_SIP
android.permission.PROCESS_OUTGOING_CALLS
7、android.permission-group.SENSORS
android.permission.BODY_SENSORS
8、android.permission-group.SMS
android.permission.SEND_SMS
android.permission.RECEIVE_SMS
android.permission.READ_SMS
android.permission.RECEIVE_WAP_PUSH
android.permission.RECEIVE_MMS
android.permission.READ_CELL_BROADCASTS
9、android.permission-group.STORAGE
android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_EXTERNAL_STORAGE