Software Archive
Read-only legacy content
17061 Discussions

Exif GPS from photolibrary frustration

Brandt__Lars
New Contributor I
328 Views

Trying to read the gps info from a photo library picture.

I've tried several cordova-plugin-camera-with-exif variants but none of them work well.

I have tried this approach: https://github.com/exif-js/exif-js wich is a little ackward.

I get the best result with this component: cordova-exif (https://github.com/guilhermefarias/cordova-exif), using destinationType = Camera.DestinationType.NATIVE_URI for iOS.
Android works every time, but iOS only work occasionally. 
If I take a picture with options.saveToPhotoAlbum = true, and then try to read the gps info from that new photo, then it doesn't work.
options.saveToPhotoAlbum doesn't strip the gps info since I can se it with location in Photos on my iPhone, so I don't know why this should be diffent from a picture taken using the official camera.

Furthermore, if I change the cordova-camera-plugin version to the newest version (2.3.0 i think) then the gps info is stripped, even for Android...Why???

So the bottom line is that I just can't find a reliable Android+iOS solution for this simple problem.
Could someone please prove me wrong?


Cordova CLI 5.4.1
cordova-plugin-file 4.3.0
cordova-plugin-compat 1.0.0
cordova-plugin-camera 2.2.0

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
328 Views

My suspicion is that your app needs permission to view the GPS information and the OS is restricting access to that data. In general, another app is providing the info, and the OS acts as an intermediary to transfer that info from that other app and your app. So the OS can lookup who has permission to access the data and who does not, allowing it to restrict access to the data during the transfer. You rarely get direct access to files that are managed by other apps or the OS directly. This is done for privacy reasons, which is why the user must give permission for App A to access contacts, for example.

I recommend you search Stack Overflow and/or contact the developers of those plugins for more info on things like permissions and "does this plugin work with iOS 10 and Android 6?" because those versions are getting much stricter about permissions.

Going any deeper into this question is beyond the scope of this forum. There may be some other developers on the forum that could help, but I suspect you'll find more information by searching Stack Overflow for questions that tag Cordova and/or PhoneGap. The XDK creates a standard Cordova app, so solutions you find there for Cordova will apply here.

0 Kudos
Reply