1

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!

pyko
  • 3,399
  • 5
  • 26
  • 31
  • if u want to use second things then your app's minsdkVersion=8.There are no two manifeast file in one project – Sumant May 26 '11 at 05:19
  • See below. `android:installLocation` does not affect backward compatibility -- `minSdkVersion` does. – Sven Viking May 26 '11 at 16:39

3 Answers3

2

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

Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243
  • hmm, i see - didn't know that 1.5 didn't allow moving to SD card. However, it seems like instead of ignoring it, 1.5 won't accept the extra option at all :( – pyko May 26 '11 at 10:35
1

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

Community
  • 1
  • 1
1

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.

Sven Viking
  • 2,660
  • 21
  • 34
  • Personally, I'd suggest just adding all the required permissions to the one project. While certainly not ideal, Android 1.5 just isn't a big enough market to make splitting the project to remove a couple of permissions worthwhile, imho. – Sven Viking May 26 '11 at 05:34
  • hmm, I could've also done targetSdkVersion="4" i believe to remove the permissions. The problem I'm having is that adding these into the manifest file seem to make it not compilable using Android 1.5.. was hoping that they (in particular installLocation=auto) could be just ignored... but seems like that is not possible :( – pyko May 26 '11 at 10:34
  • 1
    The SDK version of Android 1.5 Cupcake is 3. Placing `` in the manifest *absolutely prevents* Android 1.5 from using the app. That is the `minSdkVersion` setting's sole purpose -- it defines the minimum SDK version the app can be installed on. `targetSdkVersion` is pretty-much the maximum SDK version that the app was *designed* for. It lets Android know that compatibility features may need to be enabled for the app on newer SDK versions, to account for SDK changes that the developer would not have anticipated. `maxSdkVersion` entirely excludes newer SDKs. – Sven Viking May 26 '11 at 13:05
  • 1
    I have `android:installLocation="auto"` set on one of my own apps. It works perfectly on Android 1.5, and is visible on the Android 1.5 Market. – Sven Viking May 26 '11 at 13:08
  • Cool, good to know - I'll give it a go again tonight. Thanks :) – pyko May 27 '11 at 02:18