Skip to content

Commit

Permalink
fix(android): use provider prefix to avoid conflicts other plugin pro…
Browse files Browse the repository at this point in the history
…viders (apache#510)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>

(cherry picked from commit eb7fc33)
  • Loading branch information
LoicEvenium authored and David Boho committed Dec 7, 2021
1 parent 8e43c56 commit 442143a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<config-file target="AndroidManifest.xml" parent="application">
<provider
android:name="org.apache.cordova.camera.FileProvider"
android:authorities="${applicationId}.provider"
android:authorities="${applicationId}.cordova.plugin.camera.provider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
Expand Down
11 changes: 6 additions & 5 deletions src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,11 @@ public void takePicture(int returnType, int encodingType, boolean useFrontCamera

// Specify file so that large image is captured and returned
File photo = createCaptureFile(encodingType);
this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
applicationId + ".provider",
photo), cordova.getActivity());
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageUri.getCorrectUri());
this.imageFilePath = photo.getAbsolutePath();
this.imageUri = FileProvider.getUriForFile(cordova.getActivity(),
applicationId + ".cordova.plugin.camera.provider",
photo);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
//We can write to this URI, this will hopefully allow us to write files to get to the next step
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

Expand Down Expand Up @@ -849,7 +850,7 @@ else if (srcType == CAMERA) {
try {
if (this.allowEdit) {
Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
applicationId + ".provider",
applicationId + ".cordova.plugin.camera.provider",
createCaptureFile(this.encodingType));
performCrop(tmpFile, destType, intent);
} else {
Expand Down

0 comments on commit 442143a

Please sign in to comment.