question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[expo-image-picker] [android only] EXIF/lat-lng data not being pulled

See original GitHub issue

Summary

Seems like when we want to get LAT+LNG information from a photo taken with Android (since API leven 29, Android 10), using expo-image-picker, it doesn’t work anymore (not even adding ACCESS_MEDIA_LOCATION in the permissions).

You can get more information about this bug in:

I would say the most important information is here: https://github.com/expo/expo/pull/16541#issuecomment-1060959583, in the first point.

the current way of requesting location from EXIF tags in expo-image-picker (see ExifDataHandler class in ImagePickerUtils.kt and exifTags in ImagePickerConstants.kt) doesn’t work any longer. Reading the location is now more complex, you can see the putAssetInfo() in AssetUtils.kt in expo-media-library for the working implementation.

So… In some way, we have to move the complex-logic from expo-media-library (I guess) to expo-image-picker, in order to be able to get the exif data.

We also have another workaround, but currently it’s not doable because of a lack of an id in expo-media-picker. Check the full description I left in this comment: https://github.com/expo/expo/issues/16548#issuecomment-1116808876 To sum up the comment: expo-media-picker doesn’t provide us the exif/lat-lng data, but we could get it using MediaLibrary.getAssetInfoAsync. The problem is that MediaLibrary.getAssetInfoAsync is asking for an assetId, and ImagePicker.launchImageLibraryAsync is not retrieving any kind of assetId.

As a temporal workaround, seems like I will have to migrate the whole “upload file” flow from expo-image-picker to expo-media-library. Right?

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

44 (and probably 45. will test it soon)

Environment

  expo-env-info 1.0.3 environment info:
    System:
      OS: macOS 11.6.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.2 - ~/.nvm/versions/node/v14.18.2/bin/node
      Yarn: 1.22.18 - ~/.yarn/bin/yarn
      npm: 8.3.2 - ~/.nvm/versions/node/v14.18.2/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
      Android SDK:
        API Levels: 27, 31
        Build Tools: 23.0.1, 23.0.3, 25.0.3, 26.0.1, 27.0.3, 28.0.3, 29.0.2
        System Images: android-31 | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 2021.1 AI-211.7628.21.2111.8309675
      Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^44.0.0 => 44.0.6
      react: 17.0.1 => 17.0.1
      react-native: 0.64.3 => 0.64.3
    npmGlobalPackages:
      eas-cli: 0.52.0
      expo-cli: 5.4.3
    Expo Workflow: managed

Reproducible demo

https://snack.expo.dev/@brodanoel/no-exif

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:25 (24 by maintainers)

github_iconTop GitHub Comments

1reaction
BrodaNoelcommented, Nov 7, 2022

Get out of here

0reactions
gabrielfurinicommented, Dec 19, 2022

I can confirm the issue is still there only on Androids and SDK 47

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo-Image-Picker does not work on android - Stack Overflow
I'm facing the same problem and I downgrade the version to 13.3.1 then it worked. No config needed for expo(not sure about CLI)....
Read more >
MediaLibrary - Expo Documentation
expo -media-library provides access to the user's media library, allowing them to access their existing images and videos from your app, as well...
Read more >
CS50's Mobile App Development with React Native
CS50M was retired on 30 June 2020 and is officially deprecated. The material remains here for archive purposes only. CS50's Mobile App Development...
Read more >
types/react-native/index.d.ts - UNPKG
138, * from it when they are removed. ... 472, * Called when a long-tap gesture is detected. ... 1387, * The following...
Read more >
Fullstack React Native
Nearly every code block in this book is pulled from a runnable code example, ... Using Expo and CRNA isn't the only way...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found