Android: move app to sd (totally) - android

How can I let the user move an app to SD card, but totally?
I've used android:installLocation="auto" in the android manifest, but it seems that it not move the entire app, only a piece.
Can you explain me how to let it move totally?

There is no way you can move app "totally" to the external storage. What you are using is your best possible bet. If your app consumes lot of memory due to data such media content etc or user created media. Write code which uses the external storage to store such data.

Related

Having private pictures in your Android app, which path is correct?

I am making an app where a user can take pictures, but I don't want them to be directly accessible outside the app. The user can choose to send a picture somewhere else if they want, but by default the pictures should be internal to the app only.
What is the correct way to do this? There are so many different path defaults in Android and I am not sure which I should be using (internal memory, external memory, internal cache, external cache, SD Cards, etc).
I am looking at this link here https://developer.android.com/training/basics/data-storage/files.html
It looks like internal storage via getFilesDir() is what I am looking for, correct? However pictures are also large files and I don't know if it makes sense to put them internal to the phone or if this is bad practice.
Per the Forget the Storage Permission talk, getFilesDir() is indeed the right location for private storage of user data.

What is the safe way to store the downloaded images in android

I need to store the list of downloaded image in device.I need to know what is the best way for storing images.If i store it in sd card when the user removes the sd card from device.In that situation how to overcome this problem.
If you are bothering about the sdCard removal then only on option is available to save on phone memory that is always available.
Or if you have Internet available what about moving to cloud ???
but if the main concern is security of Images you can go with the answer of user #shree202
For the security purpose you can change the extension
Say From JPG ==>> .db
it is use less for other applications and also user manually can't change the extension
and also for more secure way You can encrypt it by changing it to byte.
If you are going to open the images right from your own application, then, you can remove the extension of the image file and then save. After that, while accessing the image you can get the file list and display it again in your application by appending the file extension.

How to prevent Android app installation if SDCard absent?

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 .

folder which is on external memory(SD card) should be accessible only to specific android app.....Is there a way?

Actually my android app takes images and stores into external storage rather than internal memory because of space constraints. the images must be available only to that particular application only
Though datas in sd card are accesscible by all application, I want my images to be stored in external but it must be secure that no other app should use those images.
Is there a way that i can programmatically protect that specific folder with password if so only that android application can use the folder contents??
Another question if i store my application database itself in external memory. will the database can be accessible by another application?
Pls help me in this
Thanks in advance
The only way to ensure that is to install the application on the SDCard directly. All private data will be stored there then (invisible to anyone but you).
To do so, just put this parameter in the AndroidManifest file, at "manifest" tag:
android:installLocation="preferExternal"
Have you tried using -
SQLiteDatabase.openOrCreateDatabase(String, SQLiteDatabase.CursorFactory)
You can simply pass "/sdcard/info.db" as the first and null as the second parameter.
And go through on google search you can get many applications which are used to protect file by user's password.

Android move to SD card behavior

I have an application that downloads most of the resources from the internet during run time.
Most of those resources are images.
I don't want the user to see those images in the gallery application or in any other application. This requirement is crucial to me since:
I'm tracking which resource was downloaded and which need to be download later.
All those resources would be meaningless to the user and would irritate him.
I don't want the user or any other application to delete those images
Note: I'm aware to the fact that rooted users can do what ever they want and I don't care that those user will mess up the app.
To fulfill those requirements I used the internal storage and it works exactly as I expected and as needed.
I do let the user to move my application to the SD card, But:
what is happening to all the files that I saved in the internal storage and to the DB?
Are they all moving to the SD card with the application? Do they stay in the internal storage?
I believe that they do stay in the internal storage, but I haven't found any documentation for it.
And after I'll understand the behavior it raise few other questions.
The only requirement that I have is that the resources would be downloaded from the internet and that the user won't see them in any other application. I don't really care where those files are being saved, I think that if the user decides to move the application to the SD card it is since he has lack of memory in the internal storage, therefor I should transfer all my resources to the SD card.
Can i save something on the SD card without those files to be public for all?
What is the best way to handle this situations?
What option do I have to handle this situation?
Can I know if the app is installed on the SD card or on the internal storage?
I would thank you all for all your insights and recommendations.
Regarding the images not being visible in the Gallery App, you should put a .nomedia file into the folder that contains your images. Example: image permissions (don't want them in gallery)
Regarding the app to SD feature, I also wanted to have info on the subject, so I cannot help you :)
Useful answer: https://stackoverflow.com/a/3687467/334493

Categories

Resources