1

SDK Version: 44.0.0

Platform: Android

When I take a photo within my Expo project, I keep getting this modal window:

enter image description here

This window shows up every time I take a photo and save it in the album.

How can I get rid of it? Does this happens because I missed to specify some permissions?

Here is my app.json

{
  "expo": {
    "name": "myapp",
    "slug": "myapp",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/images/icon.png",
    "scheme": "myapp",
    "userInterfaceStyle": "automatic",
    "splash": {
      "image": "./assets/images/adaptive.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true,
      "infoPlist": {
        "NSPhotoLibraryUsageDescription": "Allow $(PRODUCT_NAME) to access your photos.",
        "NSPhotoLibraryAddUsageDescription": "Allow $(PRODUCT_NAME) to save photos.",
        "NSCameraUsageDescription": "Allow $(PRODUCT_NAME) to use camera."
      }
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/adaptive.png",
        "backgroundColor": "#ffffff"
      },
      "permissions": [
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.CAMERA",
        "android.permission.ACCESS_MEDIA_LOCATION",
        "true"
      ],
      "package": "com.example"
    }
  }
}
VukDju
  • 63
  • 2
  • 12

1 Answers1

0

I also had no luck with permissions in the app.json, but I do think I have a workaround.

I’m guessing in your code you are using MediaLibrary.createAlbumAsync or MediaLibrary.addAssetsToAlbumAsync and passing false.

If you instead pass true to those functions, the files are copied and not moved or modified, which I think is causing the pop-up. If you want, you can then use expo-file-system to delete the original file so you don’t have any duplicate data.

See my answer to a similar question with sample code here: https://stackoverflow.com/a/76492705/22085168

Hope this is useful!

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77