You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> or you can download the entire collection as a single
39
-
> [ZIP file](https://github.com/Microsoft/Windows-universal-samples/archive/master.zip), but be
40
-
> sure to unzip everything to access shared dependencies. For more info on working with the ZIP file,
41
-
> the samples collection, and GitHub, see [Get the UWP samples from GitHub](https://aka.ms/ovu2uq).
42
-
> For more samples, see the [Samples portal](https://aka.ms/winsamples) on the Windows Dev Center.
39
+
> [ZIP file](https://github.com/Microsoft/Windows-universal-samples/archive/master.zip), but be
40
+
> sure to unzip everything to access shared dependencies. For more info on working with the ZIP file,
41
+
> the samples collection, and GitHub, see [Get the UWP samples from GitHub](https://aka.ms/ovu2uq).
42
+
> For more samples, see the [Samples portal](https://aka.ms/winsamples) on the Windows Dev Center.
43
43
44
44
This sample also shows how to:
45
45
46
-
-**Use a [geofence](http://msdn.microsoft.com/library/windows/apps/dn263744):** Receive notifications when the user's device has entered or left an area of interest.
47
-
-**Handle changes in location permissions**: Register for the Geolocator's StatusChanged event and use the [StatusChangedEventArgs](http://msdn.microsoft.com/library/windows/apps/br225600) to determine the current position status.
48
-
-**Get location from a background task**
49
-
-**Handle geofencing events from a background task**
50
-
-**Handle geovisit events from a background task**
51
-
-**Obtain satellite data:** When available, use the [GeocoordinateSatelliteData](http://msdn.microsoft.com/library/windows/apps/jj635260) class to obtain additional information on the quality of the satellite based location data.
52
-
-**Display a toast:** Notify the user when a geofencing event has occurred in the background.
53
-
-**Refresh geofence binding:** Refresh the binding on resume and after removal of a geofence. Note that removal requires subscribing to removal events if a geofence is set as single use or a duration is set.
46
+
-**Use a [geofence](http://msdn.microsoft.com/library/windows/apps/dn263744):** Receive notifications when the user's device has entered or left an area of interest.
47
+
-**Handle changes in location permissions**: Register for the Geolocator's StatusChanged event and use the [StatusChangedEventArgs](http://msdn.microsoft.com/library/windows/apps/br225600) to determine the current position status.
48
+
-**Get location from a background task**
49
+
-**Handle geofencing events from a background task**
50
+
-**Handle geovisit events from a background task**
51
+
-**Obtain satellite data:** When available, use the [GeocoordinateSatelliteData](http://msdn.microsoft.com/library/windows/apps/jj635260) class to obtain additional information on the quality of the satellite based location data.
52
+
-**Display a toast:** Notify the user when a geofencing event has occurred in the background.
53
+
-**Refresh geofence binding:** Refresh the binding on resume and after removal of a geofence. Note that removal requires subscribing to removal events if a geofence is set as single use or a duration is set.
54
54
-**Request access to the user's location:** Request access to the user's location using the RequestAccessAsync method. Important: call the RequestAccessAsync before accessing the user's location. At that time, your app must be in the foreground and RequestAccessAsync must be called from the UI thread. Until the user grants your app permission to their location, your app can't access location data.
55
-
-**Track when the user visits a location:** Poll for or receive notifications when the user spends significant time in a location.
55
+
-**Track when the user visits a location:** Poll for or receive notifications when the user spends significant time in a location.
56
56
-**Help the user change location settings:** Link to location privacy settings from your app if the user revokes access to location while your app is in the foreground. Call the LaunchUriAsync method with the URI "ms-settings://privacy/location".
57
57
58
-
Geofences need to be created in the Foreground Geofencing scenario (Scenario 4) and then you can go to Background Geofencing scenario (Scenario 5) to register for background geofencing events.
58
+
Geofences need to be created in the foreground geofencing scenario (Scenario 4) and then you can go to background geofencing scenario (Scenario 5) to register for background geofencing events.
59
59
60
-
The Geolocation sample formats and parses time and dates in the en-US locale using the Gregorian calendar and 24-hour clock. To help other locales in entering data the edit fields have a format example shown below the control. For example, Start Time would be entered mm/dd/yyyy hh:mm:ss format. February 2, 2014 at 10:34 pm would be written 2/2/2014 22:34:00. For the Dwell Time and Duration the format is dd:hh:mm:ss so a time span of 7 days, 23 hours, 45 minutes and 55 seconds would be written as 7:23:45:55.
60
+
The Geolocation sample formats and parses time and dates in the en-US locale using the Gregorian calendar and 24-hour clock. To help other locales in entering data the edit fields have a format example shown below the control. For example, Start Time would be entered mm/dd/yyyy hh:mm:ss format. February 2, 2014 at 10:34 pm would be written 2/2/2014 22:34:00. For the Dwell Time and Duration the format is dd:hh:mm:ss so a time span of 7 days, 23 hours, 45 minutes and 55 seconds would be written as 7:23:45:55.
61
61
62
-
###Declaring the Location capability
62
+
## Declaring the Location capability
63
63
64
64
This sample requires that location capability be set in the *Package.appxmanifest* file to allow the app to access location at runtime. The capability can be set in the app manifest using Microsoft Visual Studio.
65
65
66
-
67
66
## Related topics
68
67
69
68
### Conceptual
70
69
71
-
*[Get current location](https://msdn.microsoft.com/library/windows/apps/mt219698)
72
-
*[Guidelines for location-aware apps](https://msdn.microsoft.com/library/windows/apps/hh465148)
70
+
-[Get current location](https://msdn.microsoft.com/library/windows/apps/mt219698)
71
+
-[Guidelines for location-aware apps](https://msdn.microsoft.com/library/windows/apps/hh465148)
- Requires Windows SDK 10.0.22621.0 to build and Windows 10 to run.
88
86
89
87
## Build the sample
90
88
91
-
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
89
+
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
92
90
2. Start Microsoft Visual Studio and select **File**\>**Open**\>**Project/Solution**.
93
91
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio Solution (.sln) file.
94
92
4. Press Ctrl+Shift+B, or select **Build**\>**Build Solution**.
@@ -99,8 +97,8 @@ The next steps depend on whether you just want to deploy the sample or you want
99
97
100
98
### Deploying the sample
101
99
102
-
- Select Build > Deploy Solution.
100
+
- Select Build > Deploy Solution.
103
101
104
102
### Deploying and running the sample
105
103
106
-
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.
104
+
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.
0 commit comments