Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving to SD card

Tags:

android

I know move to sd card feature is available from android 2.2 I want to know is there way to detect in my program if device supports move to sd card feature, if its supported it can be moved else if not supported than nothing will happen(will be in phone memory)

My main issue is my app is supporting all devices from 1.6 to above, and i can't use

android:installLocation="auto"

because its not recognized for below version 2.2 . So do i have to do checking and enabling programmatically and if so how ? I hope you understand my problem.

Thanks.

like image 585
padam thapa Avatar asked Dec 27 '22 09:12

padam thapa


2 Answers

To allow installation on external storage and remain compatible with versions lower than API Level 8:

  1. Include the android:installLocation attribute with a value of "auto" or "preferExternal" in the <manifest> element.

  2. Leave your android:minSdkVersion attribute as is (something less than "8") and be certain that your application code uses only APIs compatible with that level.

  3. In order to compile your application, change your build target to API Level 8. This is necessary because older Android libraries don't understand the android:installLocation attribute and will not compile your application when it's present.

When your application is installed on a device with an API Level lower than 8, the android:installLocation attribute is ignored and the application is installed on the internal storage.

This is what Android's Backward Compatibility Says.

Also refer Applications That Should NOT Install on External Storage and Applications That Should Install on External Storage

like image 62
Kartik Domadiya Avatar answered Jan 08 '23 05:01

Kartik Domadiya


While the programmatic features are available from 2.2 and above, the actual move to sd feature is not actually possible on every phones, even when there is an internal or even external SD card!

In ICS and JB now, the OS can decide to move apps TO SD by itself, while users don't have any option to move apps manually to/from SD card!

This behavior has been tested on Galaxy Nexus, Galaxy S3, Galaxy Tab 2, Transformer and Iconia A500 both with ICS and JB! None of them had move-so-sd button!

So it would still be interesting to find out if user can move apps to SD at runtime.

like image 29
3c71 Avatar answered Jan 08 '23 07:01

3c71