在Android開發中,當程序執行需要操作安全敏感項時,必須在androidmanifest.xml中聲明相關權限請求。
比如,聲明撥打電話的權限請求方法如下:
1 <uses-permission 2 android:name="android.permission.CALL_PHONE" />
其他的權限聲明方法與上面的類似,Android具體權限請求可以參閱Android API幫助文檔,本文整理了該文檔中的全部權限請求,匯總如下。
android.permission.ACCESS_CHECKIN_PROPERTIES
允許程序在登記的數據庫中讀寫訪問“properties”表,改值並上傳數據( Allows read/write access to the “properties” table in the checkin database, to change values that get uploaded)
android.permission.ACCESS_COARSE_LOCATION
允許程序獲取粗略的位置(比如Cell-ID,WiFi)(Allows an application to access coarse (e.g., Cell-ID, WiFi) location)
android.permission.ACCESS_FINE_LOCATION
允許程序訪問精確位置(如GPS) (Allows an application to access fine (e.g., GPS) location)
android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
允許應用程序訪問額外的位置提供命令(Allows an application to access extra location provider commands)
android.permission.ACCESS_MOCK_LOCATION
允許程序創建模擬位置用於測試(Allows an application to create mock location providers for testing)
android.permission.ACCESS_NETWORK_STATE
允許程序訪問網絡信息(Allows applications to access information about networks)
android.permission.ACCESS_SURFACE_FLINGER
允許程序使用SurfaceFlinger底層特性(Allows an application to use SurfaceFlinger’s low level features)
android.permission.ACCESS_WIFI_STATE
允許程序訪問Wi-Fi網絡(Allows applications to access information about Wi-Fi networks)
android.permission.ADD_SYSTEM_SERVICE
允許程序發布系統級服務(Allows an application to publish system-level services).
android.permission.BATTERY_STATS
允許程序更新統計的手機電池信息(Allows an application to update the collected battery statistics)
android.permission.BLUETOOTH
允許程序連接到已配對的藍牙設備(Allows applications to connect to paired bluetooth devices)
android.permission.BLUETOOTH_ADMIN
允許程序發現和配對藍牙設備(Allows applications to discover and pair bluetooth devices)
android.permission.BRICK
請求使用禁用設備(非常危險)(Required to be able to disable the device (very *erous!).)
android.permission.BROADCAST_PACKAGE_REMOVED
允許程序在一個應用程序包移除后廣播一個提示消息(Allows an application to broadcast a notification that an application package has been removed)
android.permission.BROADCAST_STICKY
允許一個程序廣播sticky intents(Allows an application to broadcast sticky intents)
android.permission.CALL_PHONE
允許程序不通過撥號界面和用戶確認而直接撥打一個電話(Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.)
android.permission.CALL_PRIVILEGED
允許程序撥打任何號碼(包含緊急號碼),無需通過撥號用戶界面和用戶確認(Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed)
android.permission.CAMERA
請求使用照相設備(Required to be able to access the camera device. )
android.permission.CHANGE_COMPONENT_ENABLED_STATE
允許應用發生改變,當其組件啟用或禁用時(Allows an application to change whether an application component (other than its own) is enabled or not. )
android.permission.CHANGE_CONFIGURATION
允許程序修改當前配置(Allows an application to modify the current configuration, such as locale. )
android.permission.CHANGE_NETWORK_STATE
允許程序改變網絡連接狀態(Allows applications to change network connectivity state)
android.permission.CHANGE_WIFI_STATE
允許程序改變Wi-Fi連接狀態(Allows applications to change Wi-Fi connectivity state)
android.permission.CLEAR_APP_CACHE
允許程序清除設備上所有已安裝應用的緩存(Allows an application to clear the caches of all installed applications on the device. )
android.permission.CLEAR_APP_USER_DATA
允許一個程序清除用戶設置(Allows an application to clear user data)
android.permission.CONTROL_LOCATION_UPDATES
允許啟用/禁止從無線設備獲取的位置更新提示(Allows enabling/disabling location update notifications from the radio. )
android.permission.DELETE_CACHE_FILES
允許程序刪除緩存文件(Allows an application to delete cache files)
android.permission.DELETE_PACKAGES
允許程序刪除包(Allows an application to delete packages)
android.permission.DEVICE_POWER
允許訪問底層電源管理(Allows low-level access to power management)
android.permission.DISABLE_KEYGUARD
允許程序禁用鍵盤鎖(Allows applications to disable the keyguard )
android.permission.DUMP
允許程序從系統服務抓取信息並返回狀態(Allows an application to retrieve state dump information from system services.)
android.permission.EXPAND_STATUS_BAR
允許程序擴展收縮狀態欄(Allows an application to expand or collapse the status bar. )
android.permission.FACTORY_TEST
作為一個工廠測試程序,使用root用戶來運行(Run as a manufacturer test application, running as the root user. )
android.permission.FLASHLIGHT
允許訪問閃光燈(Allows access to the flashlight )
android.permission.FORCE_BACK
允許程序強行后退操作無論是否在頂層activity(Allows an application to force a BACK operation on whatever is the top activity. )
android.permission.GET_ACCOUNTS
訪問Accounts Service中的帳戶列表(Allows access to the list of accounts in the Accounts Service)
android.permission.GET_PACKAGE_SIZE
允許程序獲取任何package所占用的空間容量(Allows an application to find out the space used by any package. )
android.permission.GET_TASKS
允許程序獲取當前或最近運行的任務的有關信息,如縮略任務狀態,是否活動等等(Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.)
android.permission.HARDWARE_TEST
允許訪問硬件(Allows access to hardware peripherals. )
android.permission.INJECT_EVENTS
允許程序截獲用戶事件(如按鍵、觸摸、軌跡球等等)到事件流(Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.)
android.permission.INSTALL_PACKAGES
允許程序安裝packages(Allows an application to install packages. )
android.permission.INTERNAL_SYSTEM_WINDOW
允許打開窗口使用系統用戶界面(Allows an application to open windows that are for use by parts of the system user interface. )
android.permission.INTERNET
允許程序打開網絡套接字(Allows applications to open network sockets)
android.permission.MANAGE_APP_TOKENS
允許應用程序的窗口管理器管理(創建、銷毀、Z-order)應用程序(Allows an application to manage (create, destroy, Z-order) application tokens in the window manager. )
android.permission.MODIFY_AUDIO_SETTINGS
允許程序修改全局音頻設置(Allows an application to modify global audio settings)
android.permission.MODIFY_PHONE_STATE
允許修改話機狀態,如電源,人機接口等(Allows modification of the telephony state – power on, mmi, etc. )
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
允許掛載和卸載可移動存儲文件系統(Allows mounting and unmounting file systems for removable storage. )
android.permission.PERSISTENT_ACTIVITY
允許程序設置其Activity持久(Allow an application to make its activities persistent. )
android.permission.PROCESS_OUTGOING_CALLS
允許程序監視、修改或終止呼叫(Allows an application to monitor, modify, or abort outgoing calls)
android.permission.READ_CALENDAR
允許程序讀取用戶日歷數據(Allows an application to read the user’s calendar data.)
android.permission.READ_CONTACTS
允許程序讀取用戶聯系人數據(Allows an application to read the user’s contacts data.)
android.permission.READ_FRAME_BUFFER
允許程序進行屏幕截圖或和訪問幀緩沖區數據(Allows an application to take screen shots and more generally get access to the frame buffer data)
android.permission.READ_INPUT_STATE
允許程序返回當前按鍵狀態(Allows an application to retrieve the current state of keys and switches. )
android.permission.READ_LOGS
允許程序讀取底層系統日志文件(Allows an application to read the low-level system log files. )
android.permission.READ_OWNER_DATA
允許程序讀取持有者數據(Allows an application to read the owner’s data)
android.permission.READ_SMS
允許程序讀取短信息(Allows an application to read SMS messages.)
android.permission.READ_SYNC_SETTINGS
允許程序讀取同步設置(Allows applications to read the sync settings)
android.permission.READ_SYNC_STATS
允許程序讀取同步狀態(Allows applications to read the sync stats)
android.permission.REBOOT
請求重啟設備(Required to be able to reboot the device. )
android.permission.RECEIVE_BOOT_COMPLETED
允許程序在系統啟動完成后接收ACTION_BOOT_COMPLETED廣播(Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting. )
android.permission.RECEIVE_MMS
允許程序監視收到的彩信,進行記錄或處理(Allows an application to monitor incoming MMS messages, to record or perform processing on them. )
android.permission.RECEIVE_SMS
允許程序監視收到的短信息,進行記錄或處理(Allows an application to monitor incoming SMS messages, to record or perform processing on them.)
android.permission.RECEIVE_WAP_PUSH
允許程序監視來自WAP的信息(Allows an application to monitor incoming WAP push messages. )
android.permission.RECORD_AUDIO
允許程序錄制音頻(Allows an application to record audio)
android.permission.REORDER_TASKS
允許程序改變Z-order(Allows an application to change the Z-order of tasks)
android.permission.RESTART_PACKAGES
允許程序重啟其他程序(Allows an application to restart other applications)
android.permission.SEND_SMS
允許程序發送SMS短信(Allows an application to send SMS messages)
android.permission.SET_ACTIVITY_WATCHER
允許程序監控或控制在全局系統中啟動的Activity(Allows an application to watch and control how activities are started globally in the system.)
android.permission.SET_ALWAYS_FINISH
允許程序控制Activity是否放在后台間接運行完成(Allows an application to control whether activities are immediately finished when put in the background.)
android.permission.SET_ANIMATION_SCALE
修改全局動畫比例(Modify the global animation scaling factor.)
android.permission.SET_DEBUG_APP
配置用於調試的程序(Configure an application for debugging.)
android.permission.SET_ORIENTATION
允許訪問底層屏幕方向設置和實際旋轉(Allows low-level access to setting the orientation (actually rotation) of the screen.)
android.permission.SET_PREFERRED_APPLICATIONS
允許程序修改列表參數PackageManager.addPackageToPreferred() 和PackageManager.removePackageFromPreferred()方法(Allows an application to modify the list of preferred applications with the PackageManager.addPackageToPreferred() and PackageManager.removePackageFromPreferred() methods.)
android.permission.SET_PROCESS_FOREGROUND
允許強行當前運行程序到前台(Allows an application to force any currently running process to be in the foreground.)
android.permission.SET_PROCESS_LIMIT
允許設置最大的運行進程數量(Allows an application to set the maximum number of (not needed) application processes that can be running. )
android.permission.SET_TIME_ZONE
允許程序設置時區(Allows applications to set the system time zone)
android.permission.SET_WALLPAPER
允許程序設置壁紙(Allows applications to set the wallpaper )
android.permission.SET_WALLPAPER_HINTS
允許程序設置默認壁紙(Allows applications to set the wallpaper hints)
android.permission.SIGNAL_PERSISTENT_PROCESSES
允許程序將請求信號發送到所有顯示的進程中(Allow an application to request that a signal be sent to all persistent processes)
android.permission.STATUS_BAR
允許程序打開、關閉或禁用狀態欄及圖標(Allows an application to open, close, or disable the status bar and its icons.)
android.permission.SUBSCRIBED_FEEDS_READ
允許程序訪問訂閱RSS內容提供者(Allows an application to allow access the subscribed feeds ContentProvider. )
android.permission.SYSTEM_ALERT_WINDOW
允許程序使用TYPE_SYSTEM_ALERT類型打開窗口,顯示在其他所有程序的頂層(Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications. )
android.permission.VIBRATE
允許訪問振動設備(Allows access to the vibrator)
android.permission.WAKE_LOCK
允許使用PowerManager WakeLocks保持進程,在休眠時使屏幕變暗( Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming)
android.permission.WRITE_APN_SETTINGS
允許程序寫入APN設置(Allows applications to write the apn settings)
android.permission.WRITE_CALENDAR
允許程序寫入但不讀取用戶日歷數據(Allows an application to write (but not read) the user’s calendar data. )
android.permission.WRITE_CONTACTS
允許程序寫入但不讀取用戶聯系人數據(Allows an application to write (but not read) the user’s contacts data. )
android.permission.WRITE_GSERVICES
允許程序修改Google服務地圖(Allows an application to modify the Google service map. )
android.permission.WRITE_OWNER_DATA
允許程序寫入但不讀取持有者數據(Allows an application to write (but not read) the owner’s data.)
android.permission.WRITE_SETTINGS
允許程序讀取或寫入系統設置(Allows an application to read or write the system settings. )
android.permission.WRITE_SMS
允許程序寫短信(Allows an application to write SMS messages)
android.permission.WRITE_SYNC_SETTINGS
允許程序寫入同步設置(Allows applications to write the sync settings)