Using a camera without an SD card on Android

I just want to confirm that the camera cannot be used without an SD card on Android?

I launch the intention MediaStore.ACTION_IMAGE_CAPTURE to use the camera and try to get the camera to store the image in the application data folder

ContentValues values = new ContentValues(); values.put(Media.TITLE, "Image"); values.put(Images.Media.BUCKET_ID, path.hashCode()); values.put(Images.Media.BUCKET_DISPLAY_NAME, name); values.put(Images.Media.MIME_TYPE, "image/png"); values.put(Media.DESCRIPTION, "Image capture by camera"); values.put("_data", Constants.imagePath); Uri uri = getContentResolver().insert( Media.EXTERNAL_CONTENT_URI, values); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(cameraIntent, PICTURE_ACTIVITY); 

I assume the camera cannot access the application data folder

So, without an SD card, is it impossible to use a camera?

+7
source share
3 answers

There is another way that you can capture an image using a camera preview on your surface view.

Using this thing, you can save the previous image and capture. You can pass your cache directory of your application getCacheDir() .

Link:

1) https://github.com/commonsguy/cw-advandroid/tree/master/Camera/Preview/
2) http://android-er.blogspot.in/2010/12/camera-preview-on-surfaceview.html

+2
source

Without an SD card, the Camera app will display:

Please insert an SD card before using the camera.

No impossible.

Edit: If you check Camera source code of the application, updateStorageHint(int remaining) assumes that it will always display the text “Without storage” if there is no SD card (also check MenuHelper calculatePicturesRemaining() ).

0
source

http://developer.android.com/guide/topics/media/camera.html#saving-media suggests that you can save images in places other than the SD card:

Media files ... must be saved in the external storage directory of the device (SD card)

(My emphasis)

Using internal storage, however, quickly depletes what is usually a very limited resource and means that files are transferred only from the phone and not from the remote SD card.

I would suggest that for reliability and in the interests of “best practice” (I don’t like the phrase) you follow the recommendations in this guide.

It seems that the built-in camera application adheres to these best practices, but you could write an application that does not.

0
source

All Articles