Starting with M, permission is divided into
- Normal permission
- Runtime permission
Normal permission directly in the manifest declaration can be used.
Android.permission.ACCESS_LOCATION_EXTRA_COMMANDSandroid.permission.ACCESS_NETWORK_ STATEandroid.permission.ACCESS_NOTIFICATION_POLICYandroid.permission.ACCESS_WIFI_ STATEandroid.permission.ACCESS_WIMAX_STATEandroid.permission.BLUETOOTHandroid.permission.BLUETOOTH_ ADMINandroid.permission.BROADCAST_STICKYandroid.permission.CHANGE_NETWORK_STATEandroid.permission.CHANGE_WIFI_ MULTICAST_STATEandroid.permission.CHANGE_WIFI_STATEandroid.permission.CHANGE_WIMAX_ STATEandroid.permission.DISABLE_KEYGUARDandroid.permission.EXPAND_STATUS_ BARandroid.permission.FLASHLIGHTandroid.permission.GET_ACCOUNTSandroid.permission.GET_PACKAGE_ SIZEandroid.permission.INTERNETandroid.permission.KILL_BACKGROUND_PROCESSESandroid.permission.MODIFY_AUDIO_ SETTINGSandroid.permission.NFCandroid.permission.READ_SYNC_SETTINGSandroid.permission.READ_SYNC_ STATSandroid.permission.RECEIVE_BOOT_COMPLETEDandroid.permission.REORDER_TASKSandroid.permission.REQUEST_ INSTALL_PACKAGESandroid.permission.SET_TIME_ZONEandroid.permission.SET_WALLPAPERandroid.permission.SET_WALLPAPER_HINTSandroid.permission.SUBSCRIBED_FEEDS_ READandroid.permission.TRANSMIT_IRandroid.permission.USE_ FINGERPRINTandroid.permission.VIBRATEandroid.permission.WAKE_LOCKandroid.permission.WRITE_SYNC_ SETTINGScom.android.alarm.permission.SET_ALARMcom.android.launcher.permission.INSTALL_ SHORTCUTcom.android.launcher.permission.UNINSTALL_SHORTCUT
View Code
Runtime permission needs to ask the user for permission to use the user.
After Android SDK 23 is required, declare it in manifest.
Then add the rights-managed code.
Runtime permission is divided into groups. Each group includes multiple permissions. Once a permission is obtained from the group, other permissions are also granted directly.
Rights Management steps:
- Determine if you have a permission
if (Checkselfpermission (write_external_storage) = = packagemanager.permission_granted) { ...}
- If you do not have this permission, request permission
Requestpermissions (new string[]{write_external_storage},request_storage);
- If the user denies the permission, you can decide to stop asking for the goods
- If the user refuses to tick (don't ask again), no longer ask or show a dialog let the user go to the settings to accept permissions (note: In this case the system can no longer display the permission to ask the dialog).
Rights Management for ANDROID:M and N