什么是运行时权限?
Android 6.0最大的改变应该说是对安全性的提升,增加了运行时权限,开发人员再也不能随心所欲的控制设备了,必须要经过用户同意你才能获取权限。运行时权限顾名思义就是在程序运行时候获取用户的权限,只有用户同意,你才能真正的获取权限,不像以前直接在AndroidManifest.xml直接定义即可!
有哪些权限是运行时权限?
Android6.0 google将权限机制分为了两大类,第一类就是Normal Permissions(正常的权限,没有设计敏感数据),是不需要用户授权的,比如蓝牙,联网。还有一类就是Dangerous Permission(涉及用户隐私),需要在程序运行时请求用户同意授权。以下是两种权限的列表:
Normal Permissions权限列表:
ACCESS_LOCATION_EXTRA_COMMANDS
ACCESS_NETWORK_STATE
ACCESS_NOTIFICATION_POLICY
ACCESS_WIFI_STATE
BLUETOOTH
BLUETOOTH_ADMIN
BROADCAST_STICKY
CHANGE_NETWORK_STATE
CHANGE_WIFI_MULTICAST_STATE
CHANGE_WIFI_STATE
DISABLE_KEYGUARD
EXPAND_STATUS_BAR
GET_PACKAGE_SIZE
INSTALL_SHORTCUT
INTERNET
KILL_BACKGROUND_PROCESSES
MODIFY_AUDIO_SETTINGS
NFC
READ_SYNC_SETTINGS
READ_SYNC_STATS
RECEIVE_BOOT_COMPLETED
REORDER_TASKS
REQUEST_INSTALL_PACKAGES
SET_ALARM
SET_TIME_ZONE
SET_WALLPAPER
SET_WALLPAPER_HINTS
TRANSMIT_IR
UNINSTALL_SHORTCUT
USE_FINGERPRINT
VIBRATE
WAKE_LOCK
WRITE_SYNC_SETTINGS
Dangerous Permission权限列表:
group:android.permission-group.CONTACTS
permission:android.permission.WRITE_CONTACTS
permission:android.permission.GET_ACCOUNTS
permission:android.permission.READ_CONTACTSgroup:android.permission-group.PHONE
permission:android.permission.READ_CALL_LOG
permission:android.permission.READ_PHONE_STATE
permission:android.permission.CALL_PHONE
permission:android.permission.WRITE_CALL_LOG
permission:android.permission.USE_SIP
permission:android.permission.PROCESS_OUTGOING_CALLS
permission:com.android.voicemail.permission.ADD_VOICEMAILgroup:android.permission-group.CALENDAR
permission:android.permission.READ_CALENDAR
pe