cloudacy / native_exif

A simple EXIF metadata reader/writer for Flutter.
MIT License
16 stars 15 forks source link

Latitude/longitude values are not parsable. latValue=0/1,0/1,0/1, latRef=, lngValue=0/1,0/1,0/1, lngRef= #33

Open Jyoshnarani opened 5 months ago

Jyoshnarani commented 5 months ago

await exif!.getLatLong() retuning null value

Future<ExifLatLong?> getLatLong() async { final attributes = await getAttributes(); if (attributes == null) return null;

final latitude = attributes['GPSLatitude'];
final latitudeRef = attributes['GPSLatitudeRef'];
final longitude = attributes['GPSLongitude'];
final longitudeRef = attributes['GPSLongitudeRef'];
if (latitude is! double || latitudeRef is! String || longitude is! double || longitudeRef is! String) {
  return null;
}

return ExifLatLong(
  latitude: latitude * (latitudeRef == 'S' ? -1 : 1),
  longitude: longitude * (longitudeRef == 'W' ? -1 : 1),
);

}

This is coming in Android OS version - 14 device

rxvivek commented 4 months ago

same issue facing in android 13 and 14 java.lang.NumberFormatException: For input string: "23/1,7/1,14.080799999993864/1" E/MethodChannel#native_exif(28387): at jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054) E/MethodChannel#native_exif(28387): at jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110) E/MethodChannel#native_exif(28387): at java.lang.Double.parseDouble(Double.java:660) E/MethodChannel#native_exif(28387): at com.cloudacy.native_exif.NativeExifPlugin.setAttributes(NativeExifPlugin.kt:36) E/MethodChannel#native_exif(28387): at com.cloudacy.native_exif.NativeExifPlugin.onMethodCall(NativeExifPlugin.kt:193) E/MethodChannel#native_exif(28387): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267) E/MethodChannel#native_exif(28387): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292) E/MethodChannel#native_exif(28387): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319) E/MethodChannel#native_exif(28387): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) E/MethodChannel#native_exif(28387): at android.os.Handler.handleCallback(Handler.java:942) E/MethodChannel#native_exif(28387): at android.os.Handler.dispatchMessage(Handler.java:99) E/MethodChannel#native_exif(28387): at android.os.Looper.loopOnce(Looper.java:211) E/MethodChannel#native_exif(28387): at android.os.Looper.loop(Looper.java:300)

yasiralijaved commented 2 months ago

Most probably due to missing

Make sure to ask user to give this permission before accessing GPS from exif

Mar-debug commented 3 weeks ago

Also seem to be getting this error Mostly when picking images from gallery, seems to be getting the exif data when using camera to take photo. We do also ask location permissions on startup,