Jithin Sunny
Jithin Sunny

Reputation: 3402

Saving Image from application

In my application i have to take image using camera and save it. Is it possible to save these images to database as it should be secure. Or is there any way to save image in sd card in a way that other application cant view it Please give some advice and thanks in advance.

Upvotes: 0

Views: 161

Answers (3)

Squonk
Squonk

Reputation: 48871

If you are thinking about saving an image to a database then you may as well save it to the internal memory and save the path to it in a database. Be aware that if a phone is rooted then any application can access the internal storage area of your app.

There is no way to secure files on the SD card from other applications unless you encrypt them. In this case, you'll need to embed security keys (obviously) and if somebody reverse-engineers your app then the encryption is compromised.

In short - nothing is secure on a rooted phone and securing data on SD card is not guaranteed.

Upvotes: 0

Eldhose M Babu
Eldhose M Babu

Reputation: 14510

You can save it to database, but it is not recommended since the SQL Lite database is not intented for this purpose.

Its better to save the image to the cache directory of your application so that no other application can access it unless the device is rooted.

You can use :

context.getCacheDir() 

to get the path to cache directory.

Upvotes: 3

John Smith
John Smith

Reputation: 2738

Using camera and save the image is done by this http://code.google.com/p/crw-cmu/source/browse/luis/PhotoIntentActivity/src/com/example/android/photobyintent/PhotoIntentActivity.java?r=734

It will take the image from the camera and save it to sd card. I would suggest this way if your image has a big size , else you can save it your database. Also, if you do not want to be not viewed by other application save the image inside data folder in your application so that only your app can access.

Upvotes: 0

Related Questions