none
[UWP] Geopoint and location capability RRS feed

  • Question

  • It says in the documentation here - https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation.geopoint - that creating a Geopoint requires the location capability. But is this really the case? I don't want to access the user's location. All I want to do is set GPS info in a file like this

     private async void Button_Click_4(object sender, RoutedEventArgs e) {
                FileOpenPicker picker = new FileOpenPicker();
                picker.FileTypeFilter.Add(".jpg");
                picker.FileTypeFilter.Add(".mp4");
                var file = await picker.PickSingleFileAsync();
                if (file == null) {
                    return;
                }
                Geopoint geo = new Geopoint(new BasicGeoposition() { Latitude = 60.4, Longitude = 34.3, Altitude = 300.2 }, AltitudeReferenceSystem.Geoid);
                await GeotagHelper.SetGeotagAsync(file, geo);
            }
        }

    This seems to work when debugging on my PC whether or not I have the location capability. The one thing that doesn't work is that the altitude is not set (reading it with GetGeotagAsync returns 0). Perhaps this has something to do with the location capability, although adding that capability made no difference to me? I don't have any GPS hardware on my PC anyway, in case that makes a difference.

    Sunday, September 1, 2019 1:20 PM

Answers

  • Hi,

    I'm made a test using your code. It works well as you said. Generally, this API should be used after adding the location capability. But in fact you are not accessing the location but setting a location which is different from the scenario that described here:App Capability. I'm not sure if this will be a problem when you upload the app into the store, but based on the results, you could use Geopoint class to set a point without the capability. If you want to upload your app to the store and the submission failed due to this issue, that might be a problem and you will need to add the location capability.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 2, 2019 3:09 AM
    Moderator

All replies

  • Hi,

    I'm made a test using your code. It works well as you said. Generally, this API should be used after adding the location capability. But in fact you are not accessing the location but setting a location which is different from the scenario that described here:App Capability. I'm not sure if this will be a problem when you upload the app into the store, but based on the results, you could use Geopoint class to set a point without the capability. If you want to upload your app to the store and the submission failed due to this issue, that might be a problem and you will need to add the location capability.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 2, 2019 3:09 AM
    Moderator
  • Hi Roy,

    Thanks for the reply. Is there any way to contact the Store certification team to find out before I try to submit the app?

    Best wishes,

    Ben

    Tuesday, September 3, 2019 6:34 PM
  • Hi,

    No, but the store team will email you if your app failed to pass the certification. Then you could contact them via email.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, September 4, 2019 2:10 AM
    Moderator