Switch to SD card

I know that the transition to the SD card can be obtained in Android 2.2. I want to know if there is a way to detect in my program if the device supports the transition to the SD card function, if it is supported, it can be moved again if it is not supported, than nothing will happen (will be in the phone’s memory)

My main problem is that my application supports all devices from 1.6 to above, and I cannot use

Android: INSTALLLOCATION = "Auto"

because it is not recognized below version 2.2. So what should I do check and enable programmatically, and if so, how? Hope you understand my problem.

Thanks.

+4
source share
4 answers

To allow installation on external storage and remain compatible with versions below API level 8:

  • Include the android:installLocation with the value " auto " or " preferExternal " in the <manifest> element.

  • Leave your android:minSdkVersion as is (something less than "8") and make sure that your application code uses only APIs compatible with this level.

  • To compile your application, change the build target to API level 8. This is necessary because older Android libraries do not understand the android:installLocation and will not compile your application when it is present.

When your application is installed on a device with an API level below 8, the android:installLocation ignored and the application is installed in internal memory.

This is what Android backward compatibility is talking about.

Also refer to Applications that should not be installed on external storage and Applications that should not be installed on external storage

+6
source

Although software features are available from 2.2 and up, the actual switch to the sd function is actually not possible on all phones, even if there is an internal or even external SD card!

In ICS and JB, the OS can now decide to transfer applications to SD on their own, while users have no way to manually move applications to / from an SD card!

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

Thus, it would be interesting to know if the user can move applications to SD at runtime.

+2
source

Well, you can use this flag. Just try compiling against api level 8 and above.

Make sure the android:minSdkVersion set correctly to 4.

The old platform will ignore android:installLocation , and new platforms will honor this.

Compilation only to recognize a new flag.

Switching to an SD card is available from version 2.2 and higher, so you do not need to explicitly check it.

0
source

This is an OS-specific feature that is not specific to a particular device. You must be checking the OS version . If the SD card is not available on the device, it will not automatically display the move option.

0
source

Source: https://habr.com/ru/post/1386254/


All Articles