nicolas2k / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
1 stars 0 forks source link

MediaStore.ACTION_IMAGE_CAPTURE - pictures don't get saved #355

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Take a picture using 
        Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
then, either
//        photoIntent.putExtra("picture_file_path", photo_path);
or 
//        photoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new 
File(photo_path)));
        startActivityForResult(photoIntent, ACTIVITY_RESULT_PHOTO);

What is the expected output?
Picture is taken and saved (after a brief moment), to the path 
(/sdcard/Android/data/MY_PACKAGE/files/picture.jpg)

What do you see instead?
01-10 13:08:17.234     636-5153/? E/CachedFilesManager﹕ Failed to change mode 
on file /mnt/sdcard/thumbnail_cache/t_thumb_20140110_130816_043.jpg
    java.io.IOException: Operation not permitted
            at com.google.glass.fs.Filesystem.changeMode(Native Method)
            at com.google.glass.util.CachedFilesManager.save(CachedFilesManager.java:433)
            at com.google.glass.camera.CameraUtils.saveThumbnailToCachedFiles(CameraUtils.java:76)
            at com.google.glass.camera.ApiTakePictureActivity$1.doInBackground(ApiTakePictureActivity.java:110)
            at com.google.glass.camera.ApiTakePictureActivity$1.doInBackground(ApiTakePictureActivity.java:105)

What version of the product are you using? On what operating system?
XE12

Please provide any additional information below.
I also tried not specifying any path and instead saving the data myself like 
this:
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
            case ACTIVITY_RESULT_PHOTO: {
                if (resultCode == RESULT_OK) {
                    onPictureTaken(data.getByteArrayExtra("data"), null);
                    return;
                }
            }

And discovered that data carried no extras.

My permissions seem to be in good order:
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" android:required="true" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Original issue reported on code.google.com by eug...@wearableintelligence.com on 10 Jan 2014 at 9:16

GoogleCodeExporter commented 8 years ago
This is working as intended -- Glass camera does not support the EXTRA_OUTPUT 
intent. Instead, use the approach described in the GDK Camera developer guide 
to capture photos using the image capture intent: 
https://developers.google.com/glass/develop/gdk/media-camera/camera#capturing_im
ages_or_video

Original comment by allev...@google.com on 10 Jan 2014 at 9:25

GoogleCodeExporter commented 8 years ago
Do I not have control over where the picture gets stored initially then?

Original comment by eug...@wearableintelligence.com on 10 Jan 2014 at 9:48