Android中的Manifest.permission(应用权限)整理

来源:互联网 发布:大人变小孩软件 编辑:程序博客网 时间:2024/05/16 13:42

ACCESS_CHECKIN_PROPERTIES

允许读/写登记数据库(checkin database),中的“properties”表,用来改变他的值来上传东西。
这个权限第三方应用无法使用。
 
注:
  • 这个权限貌似出现在google map中
  • 这个权限不能添加到Manifest文件中的Application标签下,否则应用无法安装而且不会报错

  

 1     <application 2         android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" 3         android:allowBackup="true" 4         android:icon="@drawable/ic_launcher" 5         android:label="@string/app_name" 6         android:theme="@style/AppTheme" > 7         <activity 8             android:name=".MainActivity" 9             android:label="@string/app_name" >10             <intent-filter>11                 <action android:name="android.intent.action.MAIN" />12 13                 <category android:name="android.intent.category.LAUNCHER" />14             </intent-filter>15         </activity>16     </application>
 

ACCESS_COARSE_LOCATION

允许程序通过访问网络来大致确定自己设备的位置,如通过wifi或是蜂窝网络。

例:

  • 当使用LoactionManager来获取设备位置信息时,需要此权限

 

ACCESS_FINE_LOCATION

允许通过访问信息源来精确的获得设备的地理位置,如功过GPS,wifi或是蜂窝网络。

例:

  • 当使用LoactionManager来获取设备位置信息时,需要此权限

注:

  • 这个权限和上面的权限比较像,在使用的时候推荐使用这个权限

 

ACCESS_LOCATION_EXTRA_COMMANDS

允许应用可以访问额外的位置命令。这个通常是供应商提供的新API。

例:

  • LocationManager中有一个方法sendExtraCommand(String provider,String commond,Bundle extras),在使用这个方法的时候需要此权限。

 

ACCESS_MOCK_LOCATION

允许应用能够模拟地理位置提供者,在开发地图类应用的时候,需要此权限。

例:

  • 开发地理应用的时候,比如人在中国,但是需要美国的地理位置,就可以使用这个权限来模拟地理位置。
  • Demo地址http://www.cnblogs.com/qinghuaideren/p/3860972.html

注:

  • 如果开发的时候使用了这个模拟地理位置的权限,在发布应用的时候,需要剔除掉这些东西。

 

ACCESS_NETWORK_STATE

允许应用程序访问网络信息

例:

  • 我想开发过Android应用的同学们,对这个权限应该不会陌生了,没有他就没法联网。
  • 获取网络状态的时候需要添加这个权限。

 

ACCESS_SURFACE_FLINGER

允许应用程序使用SurfaceFlinger较低的特性。

第三方不能使用这个权限。

例:

  • 系统的截图功能需要这个权限。

 

ACCESS_WIFI_STATE

允许应用程序访问网络wifi的信息。

 

BATTERY_STATS

允许一个应用程序获取电池使用的统计信息(剩余电量、电池的耗电情况(各主要应用程序耗电占总耗电的百分比等)等。

例:

@Overridepublic void onCreate() {    BroadcastReceiver batteryReceiver = new BroadcastReceiver() {        int scale = -1;        int level = -1;        int voltage = -1;        int temp = -1;        @Override        public void onReceive(Context context, Intent intent) {            level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);            scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);            temp = intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);            voltage = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);            Log.e("BatteryManager", "level is "+level+"/"+scale+", temp is "+temp+", voltage is "+voltage);        }    };    IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);    registerReceiver(batteryReceiver, filter);}

 

BLUETOOTH

允许应用程序连接到已经配对的蓝牙设备上。

例:

Android蓝牙使用的Demo:http://www.cnblogs.com/wenjiang/p/3200138.html

 

BLUETOOTH_ADMIN

允许应用程序能够发现和配对蓝牙设备。

例:

Android蓝牙使用的Demo:http://www.cnblogs.com/wenjiang/p/3200138.html

注:

在使用这个权限之前需要获得BLUETOOTH的权限。

 

BRICK

申请可以关闭设备,很危险的权限。

不能被第三方应用使用。

注:

这个权限目前为止,还没有发现在哪里使用过。

 

 

BROADCAST_PACKAGE_REMOVED

当一个应用被移除的时候,允许应用程序发送一条广播。

第三方无法使用这个权限。

注:

虽然无法发送应用卸载的广播,但是可以接受这个系统发送的广播http://jasonshieh.iteye.com/blog/858402

 

 

BROADCAST_STICKY

通过使用这个权限,能够使发送的广播继续存在,这个样广播接受者能快速的获得广播的内容。

例:

Intent intent = new Intent("some.custom.action");intent.putExtra("some_boolean", true);sendStickyBroadcast(intent);

 

CALL_PHONE

允许应用不通过启动电话的键盘输入界面而直接打电话。

例:

Intent intentcall = new Intent();intentcall.setAction(Intent.ACTION_CALL);intentcall.setData(Uri.parse("tel:" + phonenumber)); // set the UristartActivity(intentcall);

注:

在使用这个方法之前需要确认设备是否支持打电话功能,否则会报错。

<uses-feature android:name="android.hardware.telephony" android:required="false" />

 

CALL_PRIVILEGED

能拨打任何电话号码,而不通过号码键盘。

这个权限不能被第三方使用。

 

 

CAMERA

能够访问设备的相机。

例:当手机中有个摄像头的时候,打开其中的一个http://www.cnblogs.com/qinghuaideren/p/3878522.html

注:

在使用之前需要添加下面这个东西

<uses-feature android:name="android.hardware.camera" android:required="false" /><uses-feature android:name="android.hardware.camera.front" android:required="false" />

 

 

 

 

 

0 0