react-native-cameraroll: Android: `deletePhotos` not working with `content://` assets

On Android, I can’t seem to be able to delete photos in the user’s gallery.

I have the following Asset/PhotoIdentifier:

{
  "group_name": [
    "Pictures"
  ],
  "id": "299",
  "image": {
    "extension": "jpg",
    "fileSize": 1065485,
    "filename": "mrousavy-3219287467027880592.jpg",
    "height": 1920,
    "orientation": 0,
    "playableDuration": null,
    "uri": "content://media/external/file/299",
    "width": 1080
  },
  "location": null,
  "modificationTimestamp": 1718290576,
  "sourceType": "UserLibrary",
  "subTypes": [],
  "timestamp": 1718290575.821,
  "type": "image/jpeg"
}

So it’s image.uri is content://media/external/file/299 - I use this code to delete it:

await CameraRoll.deletePhotos([asset.node.image.uri])

When I try to delete that, it fails with this error:

- Could not delete all media, only deleted 0 photos.

Any idea why?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (11 by maintainers)

Most upvoted comments

Hey Arjan, I’m working on it in the little free time I can find. I’m struggling a bit with the native code but have still made some progress. I’ll let you know once it’s done—though you’ll still need to find time to refactor the code anyway! 😄