When should you care about the manifest file?
- When your app need to utilize an internet connection
- If your app closes unexpectedly during startup and you don't see any other errors in your code (AND you've spend hours of debugging hehe)
Lets take a look at the manifest file for the OB-app'en app:
<?xml version="1.0" encoding="ISO-8859-1"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.bengaard" android:versionCode="3" android:versionName="2.0"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.SET_ORIENTATION"></uses-permission> <uses-permission android:name="android.permission.ACCOUNT_MANAGER"></uses-permission> <uses-permission android:name="android.permission.MANAGE_ACCOUNT"></uses-permission> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission> <uses-permission android:name="android.permission.USE_CREDENTIALS"></uses-permission> <uses-sdk android:minSdkVersion="3"></uses-sdk> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".OB" 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> </manifest>
Now, the segments that you need to pay attention to is line 4 about the internet permission. If your app uses an internet connection in any way your manifest file needs to have this permission. Otherwise it just can't use a connection and nothing will happen with your app, no error, no nothing!
Also, while developing the app it would shut down numerous times unexpectedly. I found out that the reason might be that permissions were missing from the manifest file. So I wrote some more permissions found on http://developer.android.com/guide/topics/manifest/manifest-intro.html just to be sure and that seemed to help avoid the app to shut down all the time.
When publishing your app to market notice that your manifest file has to have a package name, versionCode and versionName included. If you intend to publish your app as an update to a previous app, you need to use the same package name, a different versionCode while the versionName can be whatever you find cool. Of course, notice that if you write unnecessary permission statements your app might ask for more rights from the user than needed, which isn't a good thing. The android:minSdkVersion="3" indicates that the app runs on Android versions from 1.5 and up.