Skip to content

Commit

Permalink
GH-665 - store the imageFilePath when the app is paused (onSaveInstan…
Browse files Browse the repository at this point in the history
…ce) and restore it back.
  • Loading branch information
PieterVanPoyer committed Jan 8, 2021
1 parent 2bad1fd commit db4be57
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
private static final String GET_All = "Get All";
private static final String CROPPED_URI_KEY = "croppedUri";
private static final String IMAGE_URI_KEY = "imageUri";
private static final String IMAGE_FILE_PATH_KEY = "imageFilePath";

private static final String TAKE_PICTURE_ACTION = "takePicture";

Expand Down Expand Up @@ -1350,6 +1351,10 @@ public Bundle onSaveInstanceState() {
state.putString(IMAGE_URI_KEY, this.imageFilePath);
}

if(this.imageFilePath != null) {
state.putString(IMAGE_FILE_PATH_KEY, this.imageFilePath);
}

return state;
}

Expand All @@ -1375,6 +1380,10 @@ public void onRestoreStateForActivityResult(Bundle state, CallbackContext callba
this.imageUri = Uri.parse(state.getString(IMAGE_URI_KEY));
}

if (state.containsKey(IMAGE_FILE_PATH_KEY)) {
this.imageFilePath = state.getString(IMAGE_FILE_PATH_KEY);
}

this.callbackContext = callbackContext;
}
}

0 comments on commit db4be57

Please sign in to comment.