Issue #156: Camera.DestinationType.FILE_URI on Android not conforming to API Spec

Instead of capturing the orginal image to /sdcard/Pic.jpg or /sdcard/Capture.jpg we detect if the SD card is mounted. If mounted the file is placed in the apps temp directory at:

/sdcard/Android/data/{package name}/cache/

If the SD card is not mounted we default to internal storage at:

/data/data/{package name}/cache/
This commit is contained in:
macdonst
2011-07-15 03:30:22 +08:00
parent 53410781e4
commit eb0e0d9d11
3 changed files with 33 additions and 5 deletions
@@ -28,6 +28,7 @@ import android.graphics.Bitmap.CompressFormat;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
/**
* This class launches the camera view, allows the user to take a picture, closes the camera view,
@@ -119,14 +120,14 @@ public class CameraLauncher extends Plugin {
// Specify file so that large image is captured and returned
// TODO: What if there isn't any external storage?
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
File photo = new File(DirectoryManager.getTempDirectoryPath(ctx), "Pic.jpg");
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
this.imageUri = Uri.fromFile(photo);
this.ctx.startActivityForResult((Plugin) this, intent, (CAMERA+1)*16 + returnType+1);
}
/**
/**
* Get image from photo library.
*
* @param quality Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality)
@@ -161,7 +162,6 @@ public class CameraLauncher extends Plugin {
// If CAMERA
if (srcType == CAMERA) {
// If image available
if (resultCode == Activity.RESULT_OK) {
try {