capture returns metadata

This commit is contained in:
Kyle Corbitt
2016-04-23 12:44:39 -07:00
committed by Zack Story
parent 12b5e330cd
commit 0c789b8da0
3 changed files with 50 additions and 10 deletions
@@ -181,10 +181,12 @@ public class RCTCameraModule extends ReactContextBaseJavaModule {
public void onPictureTaken(byte[] data, Camera camera) {
camera.stopPreview();
camera.startPreview();
Map<String, Object> response = new HashMap();
switch (options.getInt("target")) {
case RCT_CAMERA_CAPTURE_TARGET_MEMORY:
String encoded = Base64.encodeToString(data, Base64.DEFAULT);
promise.resolve(encoded);
response.put("data", encoded);
promise.resolve(response);
break;
case RCT_CAMERA_CAPTURE_TARGET_CAMERA_ROLL:
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
@@ -193,7 +195,8 @@ public class RCTCameraModule extends ReactContextBaseJavaModule {
_reactContext.getContentResolver(),
bitmap, options.getString("title"),
options.getString("description"));
promise.resolve(url);
response.put("path", url);
promise.resolve(response);
break;
case RCT_CAMERA_CAPTURE_TARGET_DISK:
File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);