Rights Management for ANDROID:M and N

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.