pyko
pyko

Reputation: 3409

Multiple AndroidManifest.xml files for one project?

For the past few months, I've been developing an Android app against Cupcake (Android 1.5, API Lvl 3), and everything is working quite well (overall it is a fairly simple app).

However, recently I noticed there are two things that I would like to do:

  1. Restrict permissions to only use Internet (with API Lvl 3, it uses 2 other permissions despite only defining the Internet permission in the manifest xml)
  2. Let users move the app to SD card/external storage

Both these changes are really simple - couple of lines in AndroidManifest.xml

The solutions I found are:

  1. To restrict permissions, add: <uses-sdk android:minSdkVersion="4"/> http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
  2. To allow users to move app to SD card, add (to the manifest tag): android:installLocation="auto" http://developer.android.com/guide/topics/manifest/manifest-element.html

However, solution for #1 requires API Lvl 4 (Android 1.6) and solution for #2 requires API Lvl 8 (Android 2.2)!

So does it mean that if I want both #1 and #2 as listed above, my app will only be compatible with Android 2.2+ ?

Or, is there a way to have multiple AndroidManifest.xml files for the one project? (I know the actual code for the app works for Android 1.5 and seems a waste to exclude them simply for a couple of extra lines in the manifest file)

Thanks!

Upvotes: 1

Views: 10893

Answers (3)

Andrew Krizhanovsky
Andrew Krizhanovsky

Reputation: 610

Use Android package renaming in order to have two different packages, i.e. the same application with different AndroidManifest.xml files in one project. See https://stackoverflow.com/a/4426654/1173350

Upvotes: 1

Sven Viking
Sven Viking

Reputation: 2720

Adding android:installLocation="auto" will not adversely effect backward compatibility -- it will just be ignored by older versions of Android.

Setting <uses-sdk android:minSdkVersion="4"/> will prevent the app from being installed or displayed on the Market on Android 1.5 devices, however. That is its whole purpose.

If you need to have a different set of permissions for different SDK versions, you would unfortunately need two separate projects and two separate Market listings. You could prevent the Cupcake version of your app from displaying for newer devices by adding android:maxSdkVersion="3" to the <uses-sdk> tag.

Upvotes: 1

Sunil Kumar Sahoo
Sunil Kumar Sahoo

Reputation: 53647

Regarding Move your app to SD card. It was not before. When android 1.5 was introduced there was no such type of concept. It is newer concept for android 1.5

I donot think you can provide this functionality to android 1.5

Thanks Deepak

Upvotes: 2

Related Questions