Set install location for Android 1.6?

I'm writing an application that is compatible with Android 1.6, but I would like to give users running Android 2.2 the option of moving the application installation to their sd card.

How can I compile my application for 1.6, but still allow 2.2 users to install it to their sd?


In your manifest:

  • In <manifest>, add "android:installLocation="preferExternal"
  • Keep your current uses-sdk as "<uses-sdk android:minSdkVersion="4">"

Then go to Project > Properties > Android (on the left), change the build target to 2.2, and you're all set.

Your project will build using 2.2 (but still only requires 1.6), but devices running 1.6 will simply ignore your new "installLocation" setting in the manifest. Just be careful not to add any 2.2-introduced material in your actual code, since the compiler will no longer catch it.

This is not quite as seamless as the developer guide suggests. First, the application does not build when the installLocation is present in the manifest and the build target is set to anything other than 2.2:

error: No resource identifier found for attribute 'installLocation' in 
package 'android'

So in order to test backwards-compatibililty by setting the build target to 1.6, the manifest must be edited as well.

Second, once the build target is set to 2.2, I don't get to pick an emulator with a lower API level for testing. I can still manually start an 1.6 emulator and run the app on it, though, but I am curious if my app will appear on Android Market for 1.6 devices if my build target is 2.2 (even though minSdkVersion=4). I don't have an actual device to test. Can someone confirm that this does not affect the availability on the market?

Lastly, this warning remains:

Attribute minSdkVersion (4) is lower than the project target API level (8)

Need Your Help

How to test broadcast driver?

laravel laravel-5.1 laravel-5.2

I am wondering if its possible to test ShouldBroadcast in Laravel?

How do you use the "os.path.isfile ()" with a set "path" but a variable filename in python 2.7?

python python-2.7 path syntax-error os.path

I am working on a calculator program as a part of a much larger project and when I finally thought I had it finished I tested the defined "quit" command. However, it failed and after some research, I