Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

Commit

Permalink
bug: work around permission issue when deleting images
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrownlees committed Sep 29, 2022
1 parent 07dbdd4 commit 44f0683
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/android/CameraLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import org.json.JSONArray;
import org.json.JSONException;

import java.lang.SecurityException;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -1239,7 +1240,11 @@ private void checkForDuplicateImage(int type) {
id--;
}
Uri uri = Uri.parse(contentStore + "/" + id);
this.cordova.getActivity().getContentResolver().delete(uri, null, null);
try {
this.cordova.getActivity().getContentResolver().delete(uri, null, null);
} catch (SecurityException e) {
LOG.d(LOG_TAG, "Swallowed error, probably caused by missing permissions, while trying to delete duplicate image.");
}
cursor.close();
}
}
Expand Down

0 comments on commit 44f0683

Please sign in to comment.