Android自定义Permission
1 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 2 package="com.example.testpermission" 3 android:versionCode="1" 4 android:versionName="1.0" > 5 6 <uses-sdk 7 android:minSdkVersion="8" 8 android:targetSdkVersion="15" /> 9 10 <permission 11 android:name="com.example.permission.VIEW" 12 android:protectionLevel="normal" > 13 </permission> 14 15 <uses-permission android:name="com.example.permission.VIEW" /> 16 17 <application 18 android:icon="@drawable/ic_launcher" 19 android:label="@string/app_name" 20 android:theme="@style/AppTheme" > 21 <activity 22 android:name=".MainActivity" 23 android:label="@string/title_activity_main" > 24 <intent-filter> 25 <action android:name="android.intent.action.MAIN" /> 26 27 <category android:name="android.intent.category.LAUNCHER" /> 28 </intent-filter> 29 </activity> 30 <activity 31 android:name=".PermissionActivity" 32 android:label="@string/title_activity_permission" 33 android:permission="com.example.permission.VIEW" > 34 <intent-filter> 35 <action android:name="android.example.action.VIEW" /> 36 37 <category android:name="android.intent.category.DEFAULT" /> 38 </intent-filter> 39 </activity> 40 </application> 41 42 </manifest>
10-13行自定义一个Permission
15行申明使用Permission
33行定义使用这个Activity所需的权限