我们在 AndroidManifest.xml里需要对一些软件需要的操作做一些权限的声明,
比如我们的软件有发送短信的功能,那么就需要在 AndroidManifest.xml 里做如下声明

view plain copy to clipboard print ?
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <manifestxmlns:android="http://schemas.android.com/apk/res/android"
  3. package="cn.com.fetion.android"
  4. android:versionCode="1"
  5. android:versionName="1.0.0">
  6. <applicationandroid:icon="@drawable/icon"android:label="@string/app_name">
  7. <activityandroid:name=".welcomActivity"
  8. android:label="@string/app_name">
  9. <intent-filter>
  10. <actionandroid:name="android.intent.action.MAIN"/>
  11. <categoryandroid:name="android.intent.category.LAUNCHER"/>
  12. </intent-filter>
  13. </activity>
  14. </application>
  15. <uses-permissionandroid:name="android.permission.SEND_SMS"></uses-permission>
  16. </manifest>

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="cn.com.fetion.android" android:versionCode="1" android:versionName="1.0.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".welcomActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.SEND_SMS"></uses-permission> </manifest>

注意加粗的代码就是声明该软件具有发送短信的功能,如果不声明该权限调用该功能的时候就会出现异常,
并且系统不会报具体是什么异常。

那么android都有那些权限需要声明呢?
我们可以从android 提供的文档找到答案
具体页面在
android-sdk-windows-1.6_r1/docs/reference/android/Manifest.permission.html


Manifest.permission 这个类定义了android全部的权限共106个

ACCESS_CHECKIN_PROPERTIES 允许读写访问"properties"表在checkin数据库,改值可以修改上传 Allowsread/writeaccesstothe"properties"tableinthecheckindatabase,tochangevaluesthatgetuploaded.
ACCESS_COARSE_LOCATION 允许应用程序访问粗糙的位置(例如:Cell-ID,WiFi)。 Allowsanapplicationtoaccesscoarse(e.g.,Cell-ID,WiFi)location
ACCESS_FINE_LOCATION 允许一个程序访问精良位置(如GPS) Allowsanapplicationtoaccessfine(e.g.,GPS)location
ACCESS_LOCATION_EXTRA_COMMANDS 允许一个程序访问额外的位置来提供命令。 Allowsanapplicationtoaccessextralocationprovidercommands
ACCESS_MOCK_LOCATION 允许程序创建模拟位置提供用于测试 Allowsanapplicationtocreatemocklocationprovidersfortesting
ACCESS_NETWORK_STATE 允许程序访问有关GSM网络信息 Allowsapplicationstoaccessinformationaboutnetworks
ACCESS_SURFACE_FLINGER 允许程序使用SurfaceFlinger底层特性 AllowsanapplicationtouseSurfaceFlinger'slowlevelfeatures
ACCESS_WIFI_STATE 允许程序访问Wi-Fi网络状态信息 AllowsapplicationstoaccessinformationaboutWi-Finetworks
BATTERY_STATS 允许程序收集手机电池统计信息 Allowsanapplicationtocollectbatterystatistics
BIND_APPWIDGET 允许程序通知AppWidget服务,哪个程序可以访问AppWidget数据。 AllowsanapplicationtotelltheAppWidgetservicewhichapplicationcanaccessAppWidget'sdata.
BIND_INPUT_METHOD 输入法服务必须请求来确保只有唯一的系统可以绑定他们。 Mustberequiredbyinputmethodservices,toensurethatonlythesystemcanbindtothem.
BLUETOOTH 允许程序链接匹配的蓝牙设备。 Allowsapplicationstoconnecttopairedbluetoothdevices
BLUETOOTH_ADMIN 允许程序发现和配对蓝牙设备 Allowsapplicationstodiscoverandpairbluetoothdevices
BRICK 请求能够禁用设备(非常危险) Requiredtobeabletodisablethedevice(verydangerous!).
BROADCAST_PACKAGE_REMOVED 允许程序广播一个提示消息在一个应用程序包已经移除后 Allowsanapplicationtobroadcastanotificationthatanapplicationpackagehasbeenremoved.
BROADCAST_SMS 允许程序广播一个SMS接收提示。 AllowsanapplicationtobroadcastanSMSreceiptnotification
BROADCAST_STICKY 允许一个程序广播常用 Allowsanapplicationtobroadcaststickyintents.
BROADCAST_WAP_PUSH 允许程序广播一个WAPPUSH接收提示。 AllowsanapplicationtobroadcastaWAPPUSHreceiptnotification
CALL_PHONE 允许一个程序初始化一个电话拨号不需通过拨号用户界面需要用户确认 AllowsanapplicationtoinitiateaphonecallwithoutgoingthroughtheDialeruserinterfacefortheusertoconfirmthecallbeingplaced.
CALL_PRIVILEGED 允许一个程序拨打任何号码,包含紧急号码无需通过拨号用户界面需要用户确认 Allowsanapplicationtocallanyphonenumber,includingemergencynumbers,withoutgoingthroughtheDialeruserinterfacefortheusertoconfirmthecallbeingplaced.
CAMERA 请求访问使用照相设备 Requiredtobeabletoaccessthecameradevice.
CHANGE_COMPONENT_ENABLED_STATE 允许一个程序是否改变一个组件或其他的启用或禁用 Allowsanapplicationtochangewhetheranapplicationcomponent(otherthanitsown)isenabledornot.
CHANGE_CONFIGURATION 允许一个程序修改当前设置,如本地化 Allowsanapplicationtomodifythecurrentconfiguration,suchaslocale.
CHANGE_NETWORK_STATE 允许程序改变网络连接状态 Allowsapplicationstochangenetworkconnectivitystate
CHANGE_WIFI_MULTICAST_STATE 允许程序进入Wi-Fi连通模式。 AllowsapplicationstoenterWi-FiMulticastmode
CHANGE_WIFI_STATE 允许程序改变Wi-Fi连接状态。 AllowsapplicationstochangeWi-Ficonnectivitystate
CLEAR_APP_CACHE 允许程序清除设备上所有安装程序的缓存。 Allowsanapplicationtoclearthecachesofallinstalledapplicationsonthedevice.
CLEAR_APP_USER_DATA 允许程序清除用户数据。 Allowsanapplicationtoclearuserdata
CONTROL_LOCATION_UPDATES 允许启用禁止位置更新提示从无线模块 Allowsenabling/disablinglocationupdatenotificationsfromtheradio.
DELETE_CACHE_FILES 允许程序删除缓存文件 Allowsanapplicationtodeletecachefiles.
DELETE_PACKAGES 允许程序删除数据包 Allowsanapplicationtodeletepackages.
DEVICE_POWER 允许访问底层电源管理 Allowslow-levelaccesstopowermanagement
DIAGNOSTIC 允许程序RW诊断资源 AllowsapplicationstoRWtodiagnosticresources.
DISABLE_KEYGUARD 允许程序禁用键盘锁 Allowsapplicationstodisablethekeyguard
DUMP 允许程序恢复状态转存信息通过系统服务 Allowsanapplicationtoretrievestatedumpinformationfromsystemservices.
EXPAND_STATUS_BAR 允许程序扩展或折叠状态栏 Allowsanapplicationtoexpandorcollapsethestatusbar.
FACTORY_TEST 作为一个工厂测试程序,运行在root用户 Runasamanufacturertestapplication,runningastherootuser.
FLASHLIGHT 允许访问闪光灯 Allowsaccesstotheflashlight
FORCE_BACK 允许程序强行一个返回程序无论什么在顶层活动 AllowsanapplicationtoforceaBACKoperationonwhateveristhetopactivity.
GET_ACCOUNTS 允许账户服务访问账户列表 AllowsaccesstothelistofaccountsintheAccountsService
GET_PACKAGE_SIZE 允许一个程序获取任何package占用空间容量 Allowsanapplicationtofindoutthespaceusedbyanypackage.
GET_TASKS 允许一个程序获取信息有关当前或最近运行的任务,一个缩略的任务状态,是否活动等等 Allowsanapplicationtogetinformationaboutthecurrentlyorrecentlyrunningtasks:athumbnailrepresentationofthetasks,whatactivitiesarerunninginit,etc.
GLOBAL_SEARCH 许可可能被用在内容提供商上,为了允许全局搜索系统访问他们数据 Thispermissioncanbeusedoncontentproviderstoallowtheglobalsearchsystemtoaccesstheirdata.
HARDWARE_TEST 允许访问硬件设备 Allowsaccesstohardwareperipherals.
INJECT_EVENTS 允许一个程序截获用户事件如按键、触摸、轨迹球等变成事件流并发送他们到任何窗口。 Allowsanapplicationtoinjectuserevents(keys,touch,trackball)intotheeventstreamanddeliverthemtoANYwindow.
INSTALL_LOCATION_PROVIDER 允许程序安装一个位置提供商到位置管理处。 AllowsanapplicationtoinstallalocationproviderintotheLocationManager
INSTALL_PACKAGES 允许一个程序安装包 Allowsanapplicationtoinstallpackages.
INTERNAL_SYSTEM_WINDOW 允许打开窗口使用系统用户界面 Allowsanapplicationtoopenwindowsthatareforusebypartsofthesystemuserinterface.
INTERNET 允许程序打开网络套接字 Allowsapplicationstoopennetworksockets.
MANAGE_APP_TOKENS 允许程序管理(创建、撤消、z-order默认向z轴推移)程序引用在窗口管理器 Allowsanapplicationtomanage(create,destroy,Z-order)applicationtokensinthewindowmanager.
MASTER_CLEAR 目前还没有明确的解释,Android开发网分析可能是清除一切数据,类似硬格机
MODIFY_AUDIO_SETTINGS 允许程序修改全局音频设置 Allowsanapplicationtomodifyglobalaudiosettings
MODIFY_PHONE_STATE 允许修改话机状态,如电源,人机接口等 Allowsmodificationofthetelephonystate-poweron,mmi,etc.
MOUNT_FORMAT_FILESYSTEMS 允许格式化文字系统可移动存储。 Allowsformattingfilesystemsforremovablestorage.
MOUNT_UNMOUNT_FILESYSTEMS 允许挂载和反挂载文件系统可移动存储 Allowsmountingandunmountingfilesystemsforremovablestorage.
PERSISTENT_ACTIVITY 允许一个程序设置他的activities显示 Allowanapplicationtomakeitsactivitiespersistent.
PROCESS_OUTGOING_CALLS 允许程序监视、修改有关播出电话 Allowsanapplicationtomonitor,modify,orabortoutgoingcalls.
READ_CALENDAR 允许程序读取用户日历数据 Allowsanapplicationtoreadtheuser'scalendardata.
READ_CONTACTS 允许程序读取用户联系人数据 Allowsanapplicationtoreadtheuser'scontactsdata.
READ_FRAME_BUFFER 允许程序屏幕波或和更多常规的访问帧缓冲数据 Allowsanapplicationtotakescreenshotsandmoregenerallygetaccesstotheframebufferdata
READ_HISTORY_BOOKMARKS 允许程序读取(但不能写入)用户浏览器的历史记录和收藏夹。 Allowsanapplicationtoread(butnotwrite)theuser'sbrowsinghistoryandbookmarks.
READ_INPUT_STATE 允许程序恢复按键的当前状态。 Allowsan<span style="mso-spa

更多相关文章

  1. android UI 的去标题栏和去状态栏(全屏)
  2. Android英文文档翻译系列(1)——AlarmManager
  3. 如何构建Android(安卓)Sync Provider :Part1
  4. Window环境下搭建android NDK开发环境
  5. 单元测试;Android应用程序架构;电话拔号器;短信发送器
  6. 如何发布android应用程序
  7. 应用Style和Theme - Android官方文档中文翻译
  8. Android(安卓)intent category大全
  9. 自动修改android模拟设备号imei的小程序

随机推荐

  1. 更新Anadroid SDK Tooks之后,Eclipse提示N
  2. Unbuntu下Android(安卓)studio报Unable t
  3. Android(安卓)WheelView(滑轮组件)使用
  4. Android性能优化——合理进行内存管理
  5. Android(安卓)DownloadManager下载状态查
  6. PendingIntent实现原理和代码
  7. 快速了解Android(安卓)onMeasure() onLay
  8. 什么是AIDL
  9. 如何实现Android(安卓)布局背景模糊化处
  10. Android打开系统设置界面