How to force android to install app on internal memory - android

I've an app that i download from private server, it installs ok on most phones but i'm having problems installing it on a HTC Desire C. The phone has no sdcard present. I've searched around and found a manifest setting that should hint at internal storage or say that there is at least no preference to where the app is installed.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.carefreegroup"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto" >
This does not work however.
How can i tell android that the app MUST be installed on the internal memory
Thanks Matt

set in Manifest
android:installLocation="internalOnly"
this will install app in internal storage and will not install it at all if there is no space in internal memory
http://developer.android.com/guide/topics/manifest/manifest-element.html

The attribute android:installLocation can have following possible values.
internalOnly: The application must be installed on the internal device storage only. If this is set, the application will never be installed on the external storage. If the internal storage is full, then the system will not install the application. This is also the default behavior if you do not define android:installLocation.
auto: The application may be installed on the external storage, but the system will install the application on the internal storage by default. If the internal storage is full, then the system will install it on the external storage. Once installed, the user can move the application to either internal or external storage through the system settings.
preferExternal: The application prefers to be installed on the external storage (SD card). There is no guarantee that the system will honor this request. The application might be installed on internal storage if the external media is unavailable or full, or if the application uses the forward-locking mechanism (not supported on external storage). Once installed, the user can move the application to either internal or external storage through the system settings.

According to the docs if you do not set that preference, the app will be installed on internal storage and it won't be movable.

Related

Confusion in External Storage in android

1)Question
I have used installLocation in manifest
android:installLocation="preferExternal"
Correct me if i am wrong. android:installLocation="preferExternal" make your app install on external sdcard . If this is true then i should not be able to use myapplication when sdcard is removed . But however i can use myapplication even when i removed sdcard from my device
2)Question
what is the difference between sdcard0 and extsdcard on my device ?
even when i use in my manifest
android:installLocation="preferExternal"
all app files are stored on sdcard0 and it is accessible even when i have sdcard in my device . i have used below method to store files on sdcard
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
So in which condition my files will be stored on my sdcard ?
and how can i store files on extsdcard?
1) As stated in the docs:
If you declare "preferExternal", you request that your application be
installed on the external storage, but the system does not guarantee
that your application will be installed on the external storage.
Unmounting the external storage means that all running apps that were installed there will be immediately killed. If you are still able to use your app, I see 2 possible reasons: the system decided to install your app on the internal storage OR your device also features an emulated "external" storage and your app was installed there.
2)
what is the difference between sdcard0 and extsdcard on my device
It's common that sdcard0 refers to the device internal storage while extsdcard refers to the external storage that might be physical or emulated. However there's no reliable naming convention, it's up to the vendor.
Also note that "external" an Android basically means "a storage that the user can access".
A few further steps that might help:
use ADB Shell to examine your device's storage structure, with SD card attached and detached
verify your app's install location from the "Apps" settings menu
Log absolute paths of directories provided by different methods of the Environment class
Note: generally, you should never rely on assumptions of your app's install location since that might get you in trouble on some devices

Force app to install on internal storage

I want my app to be installable only on internal storage.
I have tried two options:
Not specifying any storage preference in the manifest (the Docs say that this forces the app to install only to internal storage)
Explicitly specifying android:installLocation="internalOnly" in the manifest
In both cases, when I try to install it on a tablet that's running Android 4.4.2, Kernel 3.4.67, and having an SD card, it prompts me to select whether the app should be installed on Tablet Storage or the SD card.
The tablet has ample free internal storage (9 GB). The default write disk is also set to Internal Storage.
Is there any way to bypass this prompt and install to internal storage after the user approves the permissions needed by the app?
According to the docs, the flag you are using should not allow install on the SDCARD or any external storage. This appears to be a bug.
Post at the bug location to help give it attention.

how to use manifest tags

i set in my AndroidManiifest.xml
android:installLocation="internalOnly"
my question is if the internal memory is full and when we want to install the app to device can be installed on external memory?
The documentation is rather clear on that:
The application must be installed on the internal device storage only. If this is set, the application will never be installed on the external storage. If the internal storage is full, then the system will not install the application. This is also the default behavior if you do not define android:installLocation.
Using android:installLocation="auto" if the internal memory is full the system will install the app on the external memory.

Difference between auto and preferExternal instal location Android manifest

What is the difference between auto and preferExternal instal locations in android manifest? Both options can instal application on External memory. Is it something big and important? Which is better to set?
If you declare preferExternal, you request that your application be installed on the external storage, but the system does not guarantee that your application will be installed on the external storage. If the external storage is full, the system will install it on the internal storage.
If you declare auto, you indicate that your application may be installed on the external storage, but you don't have a preference of install location. The system will decide where to install your application based on several factors. The user can also move your application between the two locations.
reference
http://developer.android.com/guide/topics/data/install-location.html

Move Android application to SD instead of interal memory

In my manifest file, how can i tell the application to be installed in the sd memory instead of the internal memory.
Thanks
Add android:installLocation="preferExternal" to the <manifest> element of your AndroidManifest.xml file. Quoting the documentation for preferExternal:
There is no guarantee that the system will honor this request. The application might be installed on internal storage if the external media is unavailable or full, or if the application uses the forward-locking mechanism (not supported on external storage). Once installed, the user can move the application to either internal or external storage through the system settings.

Categories

Resources