When should I define my Android app as not movable to SD card (installLocation=internalOnly)?
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 ap开发者_如何学Gop.
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.
Have a look at this app on PS.
The service must not stop and it should run all the night. In this kind of scenarios as suggested by Peter Lillevold. We must explicitly mention
android:installLocation="internalOnly"
精彩评论