- A short example of an application's manifest file; including two activities, a provider, a service, a broadcast receiver and a few permissions and features.
Android: Manifest example
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- notice the "package" attribute -->
3 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
4 package="pt.experiments"
5 android:versionCode="1"
6 android:versionName="1.0">
7
8 <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
9
10 <uses-permission android:name="android.permission.INTERNET" />
11 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
12
13 <uses-feature android:name="android.hardware.camera" />
14 <uses-feature android:name="android.hardware.microphone" />
15
16 <application android:label="@string/app_name"
17 android:icon="@drawable/ic_launcher"
18 android:theme="@style/AppTheme">
19
20 <!-- activity in "pt.experiments.activity.MainActivity" -->
21 <activity
22 android:name=".activity.MainActivity"
23 android:label="@string/app_name"
24 android:screenOrientation="portrait"
25 android:theme="@android:style/Theme.DeviceDefault.NoActionBar" >
26 <intent-filter>
27 <action android:name="android.intent.action.MAIN" />
28 <category android:name="android.intent.category.LAUNCHER"/>
29 </intent-filter>
30 </activity>
31
32 <activity
33 android:name=".activity.AnotherActivity"
34 android:label="@string/app_name"
35 android:screenOrientation="portrait"
36 android:theme="@android:style/Theme.DeviceDefault.NoActionBar" >
37 <intent-filter>
38 <action android:name="android.intent.action.VIEW" />
39 <category android:name="android.intent.category.DEFAULT"/>
40 </intent-filter>
41 </activity>
42
43 <!-- notice the intent actions that can start this service -->
44 <service
45 android:name="pt.stuff.service.MainService"
46 android:enabled="true"
47 android:process=":newprocessname"
48 android:exported="true"
49 android:label="@string/app_name" >
50 <intent-filter>
51 <action android:name="pt.stuff.service.MainService"/>
52 <action android:name="pt.stuff.service.MainService.Manager"/>
53 <action android:name="pt.stuff.service.MainService.App"/>
54 </intent-filter>
55 </service>
56
57 <receiver
58 android:name="pt.stuff.MyReceiver">
59 <intent-filter>
60 <action android:name="pt.stuff.RECEIVE_THIS"/>
61 </intent-filter>
62 </receiver>
63
64 <!-- notice that the provider is not exported; internal use only -->
65 <provider
66 android:authorities="pt.stuff.storage.DataBaseProvider"
67 android:name="pt.fraunhofer.stuff.DataBaseProvider"
68 android:enabled="true"
69 android:exported="false"
70 />
71
72 </application>
73
74 </manifest>
Comments
Sign in to leave a comment.

