需要动态申请的权限和普通权限

权限分为两种:
第一种就是危害不大的,比如手机振动权限,这种权限是用户在安装程序的时候添加的,和之前请求权限是一样的,没有任何变化,就是在清单文件中添加相关的权限,这些权限我简单的列了出来:

  1. android.permission.ACCESS_LOCATION_EXTRA_COMMANDS

  2. android.permission.ACCESS_NETWORK_STATE

  3. android.permission.ACCESS_NOTIFICATION_POLICY

  4. android.permission.ACCESS_WIFI_STATE

  5. android.permission.ACCESS_WIMAX_STATE

  6. android.permission.BLUETOOTH

  7. android.permission.BLUETOOTH_ADMIN

  8. android.permission.BROADCAST_STICKY

  9. android.permission.CHANGE_NETWORK_STATE

  10. android.permission.CHANGE_WIFI_MULTICAST_STATE

  11. android.permission.CHANGE_WIFI_STATE

  12. android.permission.CHANGE_WIMAX_STATE

  13. android.permission.DISABLE_KEYGUARD

  14. android.permission.EXPAND_STATUS_BAR

  15. android.permission.FLASHLIGHT

  16. android.permission.GET_ACCOUNTS

  17. android.permission.GET_PACKAGE_SIZE

  18. android.permission.INTERNET

  19. android.permission.KILL_BACKGROUND_PROCESSES

  20. android.permission.MODIFY_AUDIO_SETTINGS

  21. android.permission.NFC

  22. android.permission.READ_SYNC_SETTINGS

  23. android.permission.READ_SYNC_STATS

  24. android.permission.RECEIVE_BOOT_COMPLETED

  25. android.permission.REORDER_TASKS

  26. android.permission.REQUEST_INSTALL_PACKAGES

  27. android.permission.SET_TIME_ZONE

  28. android.permission.SET_WALLPAPER

  29. android.permission.SET_WALLPAPER_HINTS

  30. android.permission.SUBSCRIBED_FEEDS_READ

  31. android.permission.TRANSMIT_IR

  32. android.permission.USE_FINGERPRINT

  33. android.permission.VIBRATE

  34. android.permission.WAKE_LOCK

  35. android.permission.WRITE_SYNC_SETTINGS

  36. com.android.alarm.permission.SET_ALARM

  37. com.android.launcher.permission.INSTALL_SHORTCUT

  38. com.android.launcher.permission.UNINSTALL_SHORTCUT

第二种权限就是涉及到用户隐私之类的权限,这类权限就需要在代码中动态请求用户批准了,权限被分组了,如下表:


这里写图片描述

动态申请:

if(checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){            requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},1);        }

还可以复写Activity的onRequestPermissionsResult方法,监听申请结果

    /**     * Callback for the result from requesting permissions. This method     * is invoked for every call on {@link #requestPermissions(String[], int)}.     * 

* Note: It is possible that the permissions request interaction * with the user is interrupted. In this case you will receive empty permissions * and results arrays which should be treated as a cancellation. *

* * @param requestCode The request code passed in {@link #requestPermissions(String[], int)}. * @param permissions The requested permissions. Never null. * @param grantResults The grant results for the corresponding permissions * which is either {@link android.content.pm.PackageManager#PERMISSION_GRANTED} * or {@link android.content.pm.PackageManager#PERMISSION_DENIED}. Never null. * * @see #requestPermissions(String[], int) */ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { /* callback - no nothing */ }

你可能感兴趣的:(需要动态申请的权限和普通权限)