In which cases I should forbid the users to move my app to the SD Card (by setting installLocation
to internalOnly
)?
I'm asking to know this for a few apps, so please don't ask about my app. I want to know this in general for any app.
All files of the app are moved to sd card except one little pointer in the internal storage that tells the system where the app is located. (imagine if you format your SD card manually, then your phone won't know app has dissapeared) but if you unmount it phone won allow you to access.
Reason 1.Developers of Android apps need to explicitly make their apps available to move to the SD card using the “android:installLocation” attribute in the <manifest> element of their app. If they don't, the option to “Move to SD card” is grayed out.
Go to Settings > Apps and tap the app you want to move to your SD card. Next, under the Storage section, tap Move to SD Card. The button will be grayed out while the app moves, so don't interfere until it's done. If there's no Move to SD Card option, the app cannot be moved.
android:installLocation="auto" — specifies that the phone's configuration will determine the installation location. Generally, your app will be installed to internal storage if sufficient space is available.
The requirements is quite well described in the documentation. Primarily, if you're running anything in the background that must execute at all times, like a service, or if you provide widgets, you can run from external storage. But as soon as the user unmount the external storage, the process in which these things run will be terminated.
If you define android:installLocation="auto"
inside the manifest
inside the AndroidManifest.xml file then and then(yes it must) it will allows user to move app to SD card option.
There are 3 values you can set to android:installLocation attribute:
android:installLocation="auto"
android:installLocation="internalOnly"
android:installLocation="preferExternal"
The Android documentation has a pretty comprehensive list about this - http://developer.android.com/guide/appendix/install-location.html
The key point is that when the user starts using the device as a USB drive, Android will kill everything related to your app. So, anything which has to run in the background to function properly or has to use the external storage should not be put on the SD card.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With