Android Question Setting #CanInstallToExternalStorage to "auto"?

Computersmith64

Well-Known Member
Licensed User
Longtime User
If I put android:installLocation="auto" in the manifest after B4A has already set android:installLocation="preferExternal", will my "auto" setting over-ride the "preferExternal" setting?

If I set #CanInstallToExternalStorage: False, then B4A writes android:installLocation="internalOnly" into the manifest (which seems to be an undocumented value & is also redundant, as the documentation states that if you leave the installLocation attribute out, then it will only allow the app to be installed on the device internal storage -> http://developer.android.com/guide/topics/data/install-location.html).

If I set #CanInstallToExternalStorage: True, then B4A writes android:installLocation="preferExternal" into the manifest & as a result the app is installed to the SD card (unless there is no space on the card or the device doesn't have one).

I don't want make the SD card the preferred installation location, but I do want the user to be able to move the app there if they want to. The Android documentation states that there is an "auto" option, which allows the OS to decide where to install, but still lets the user move it if they wish. I tried adding SetApplicationAttribute(android:installLocation, "auto") in the Manifest editor & this attribute is added into the AndroidManifest after the android:installLocation="preferExternal" line - but seems to have no efffect. The app is still installed to the SD card.

Having said all that, I've only tried this on one device that has an SD card (my Galaxy S3), so perhaps the OS is just deciding that even with installLocation="auto" it still thinks the SD card is a better place to install?

Thanks - Colin.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
It is a manifest attribute, not application.
Set it with SetManifestAttribute and it will replace the other setting.
Ah-ha! Yes that worked, thanks Erel. I do have a question about syntax though. In this post ->http://www.b4x.com/android/forum/threads/wish-for-1-8.13954/#post-78942, you provided an example where you had both the parameters in quotes (eg: SetManifestAttribute("android:installLocation", "auto"), however I put it in the manifest without quotes around the android:installLocation & it still seems to have worked fine. Was your post a typo, or doesn't it matter whether you use quotes or not? (I couldn't find any documentation on it)

Thanks - Colin.
 
Upvote 0
Top