Apparence-io / CamerAwesome

πŸ“Έ Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
911 stars 200 forks source link

iOS: location permissions not requested on camera open if config sets saveGPSLocation to true #369

Open ynnob opened 1 year ago

ynnob commented 1 year ago

Steps to Reproduce

-> iOS Application with NSLocationWhenInUseUsageDescription permission set in the info.plist Open a Camera Widget with CameraAwesomeBuilder.custom constructor and pass the config that enables gps on open

 saveConfig: SaveConfig.photo(
          [...]
          exifPreferences: ExifPreferences(
            saveGPSLocation: true,
          ),
        ),

As the content for the layout use AwesomeCameraLayout and add the AwesomeLocationButton(state: state) to the widget.

Expected results

If this is the first time the camera is opened and no gps permissions were previously requested i expect the application to ask the user for permissions. if the user declines the GPS-Permission the location icon should change to the deactivated state. If the user confirms the permissions the icon should indicate that locations are enabled. On Android this is how CamerAwesome functions.

Actual results

On iOS however the icon does not respond to changes if the location permission gets denied the icon is still active and will not respond to any actions. Furthermore while opening the camera the first time with the config above, the permission request is not even triggered. The first time it will get triggered is when deactivating the gps wia the AwesomeLocationButton.

Is there a way to use a custom button and set these settings manually so i canhandle the permission request and the UI updates. Because even if this will work on iOS there is no way to intercept the request if the location settings are tunred off completly in the iOS settings. Normally this would promt an info for the user and open the settings menu.

About your device

Brand Model OS
Apple iPhone 12 mini 16.1.2

Your flutter version

[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.19045.3086], locale de-DE)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web                                                
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2022 17.1.1)  
[√] Android Studio (version 2022.2)                                             
[√] VS Code (version 1.78.2)                                                    
[√] Connected device (4 available)
[√] Network resources

CamerAwesome Version

2.0.0-dev.1

ynnob commented 11 months ago

Additional info: It seems like deactiviating the "location" setting in the camera does not deactivate the location tracking. The geo data still gets added to the exif-metadata of the image.

ynnob commented 11 months ago

Handling the gps permissions manually and then setting saveGPSLocation to true does not geotagg the images even tho the app has full permissions.

rubencalje commented 1 month ago

I also came across this issue. I do not display the location-button in my app, but set saveGpsLocation to True:

CameraAwesomeBuilder.awesome(
    saveConfig: SaveConfig.photo(
        exifPreferences: ExifPreferences(saveGPSLocation: true),
    ),
    topActionsBuilder: (state) {
        return AwesomeTopActions(
            state: state,
            children: [],
        );
      },
    ...
)

On Android devices, the photos taken this way contain GPS information. On iOS however, this information is missing.

ynnob commented 1 month ago

I also came across this issue. I do not display the location-button in my app, but set saveGpsLocation to True:

CameraAwesomeBuilder.awesome(
    saveConfig: SaveConfig.photo(
        exifPreferences: ExifPreferences(saveGPSLocation: true),
    ),
    topActionsBuilder: (state) {
        return AwesomeTopActions(
            state: state,
            children: [],
        );
      },
    ...
)

On Android devices, the photos taken this way contain GPS information. On iOS however, this information is missing.

i have no hope that this will get fixed soon. It get's even worse when the gps signal is poor or not existent like in a tunnel. The preview and the process of taking a picture will wait a long time for the gps signal.

We now deactivated the gps tracking by this plugin and we add the gps position to the images exif data in a background task (fire and forget style).