My requirement is to be able to move all apps installed on the device(tablet) to an external SD card with the click of a button.
My research says, unless a .apk file have a manifest attribute installLocation specified as auto or preferExternal, the app cannot be moved.
Using PackageManager class allows me to get a list of all files installed on the device.
But I cannot find how to move an app, is it possible?
It is not possible to move apps to external storage if they are not specified as being allowed to, unless your device is rooted.
Related
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
I was wondering, when we download an app which is very cool but before you install it ask to give permission for almost everything you have on the phone. Even that app can make call without your permission to your contacts. Given this scenario, how do we say an unrooted device where app data is secured from other app access? if I have an app which stores data on the device memory then would that be accessed by one of those app which takes all permission before installed?
Thanks in advance for your response.
Apps are still sandboxed, they can't access each others internal storage even with requested permissions.
I'm not sure this is the correct forum for your question though as it's not related to developing. This isn't the right site for IT support.
Edit
As mentioned in the comments - anything put somewhere insecure location such as the SD card would be readable, but the default file storage is a bit more secure.
From the android docs (http://developer.android.com/training/basics/data-storage/files.html)
Note: Your app's internal storage directory is specified by your app's
package name in a special location of the Android file system.
Technically, another app can read your internal files if you set the
file mode to be readable. However, the other app would also need to
know your app package name and file names. Other apps cannot browse your internal directories and do not have read or write access unless you explicitly set the files to be readable or writable.
I have an app on Google Play market and I added android:installLocation="preferExternal" to manifest.xml file and released long time ago. Now I would like to add Android home screen widget, so I need to change it to android:installLocation="internalOnly". If I do that, what happens when a user upgrades? because a user already installed the old app on SD card. What is the best solution for this situation??
If someone has this kind of experience, please advise me.
Thanks in advance :)
When you set install location to preferExternal the application specific files are stored in .android_secure directory in external sdcard.
These type of application are not available when user mounts the SD Card as USB Mass Storage (feature removed from Android Jelly Bean).
Coming to the question, I believe in your case the application would be installed onto internal memory with the files from .android_secure moved to internal location.
You can confirm this by the following:
Install the application from play store having install Location as preferExternal.
Confirm that your application is installed in external SD card, you can use Settings->App to check that.
Now create your new signed application package.
Install using adb install -r myapp.apk
Again goto Settings->App and confirm the location.
Run functional test to see if nothing is broken.
Old question, but according to my test, if an app is installed on SD card and you change afterwards the Manifest to android:installLocation="internalOnly" (or omit the android:installLocation attribute, which is the same), when the app is upgraded the package manager will automatically move the app from SD Card to internal storage.
No idea what happens if this is not possible (not enough root on internal storage for example).
My code logic needs an SD card installed in the device. I have added a check for this case in the application's splash screen, but would like to inform users before they download/install this app. Is there a way to achieve this ?
Thanks !
There is no way to do this before the app installs, as the only way to limit such things is by using the <uses-feature> tag. However, that tag has no options for storage requirements. The best warning you can give is to prominently include it in your app description.
On the other hand, every device I've ever heard of an encountered has some form of external storage, be it a SD Card or inbuilt memory mounted as external storage. What you're doing by using the Splash Screen to check for the external storage is the best way to do this, as there is no other option.
There's no way to do that. Your app have to be installed to be able to check user's environment. You could try to to enforce SD card installation of your app, so if there's none Google Play might (not tested) simply not allow app installation at all, but it will not solve your problem as user will still do not know why. Solution is to clearly state in product description that SD card is mandatory. But note, that requiring SD card is risky as many devices does not have any while still offer external storage. My suggestion - just add note about storage requirements and let system deal with it.
I think it is NOT POSSIBLE . You are checking the sdcard on splash screen and prevent user for next process is the right solution or Use android:installLocation for install android application on sdcard.
Beginning with API Level 8, you can allow your application to be
installed on the external storage (for example, the device's SD card).
This is an optional feature you can declare for your application with
the android:installLocation manifest attribute.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
... >
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. The user can also move your application between the
two locations.
When your application is installed on the external storage:
There is no effect on the application performance so long as the
external storage is mounted on the device.
The .apk file is saved on the external storage, but all private user
data, databases, optimized .dex files, and extracted native code are
saved on the internal device memory.
The unique container in which your application is stored is encrypted
with a randomly generated key that can be decrypted only by the
device that originally installed it. Thus, an application installed
on an SD card works for only one device.
The user can move your application to the internal storage through
the system settings.
Look Here for more details .
Does anyone know if you can install an apk inside of another apk's storage space? My goal is to create an application which can "house" other applications inside of itself. Or possibly if one application can get the INSTALL_PACKAGES permission (which I believe is reserved by SYSTEM?) could it install applications in a specific location on the device or the SD card?
Imagine an application that can just load other applications and install them on your device without your consent. Especially if the loaded application uses different permissions as the "host"-application.
I hope this is not possible. At least not without user interaction!Otherwise we would be facing severe security leaks and open doors for malware ...
If you use the same package name for both applications, you could share the storage space.