1 out of 4 rated this helpful - Rate this topic

StatusChangedEventArgs class

Applies to Windows and Windows Phone

Provides information for the StatusChanged event.

Syntax

Public NotInheritable Class StatusChangedEventArgs

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The StatusChangedEventArgs class has these types of members:

Properties

The StatusChangedEventArgs class has these properties.

PropertyAccess typeDescription

Status

Read-onlyThe updated status of the Geolocator object.

 

Remarks

This object is the argument passed to the handler for the StatusChanged event.

Examples

This code example demonstrates how the StatusChanged event is handled.



loc = new Windows.Devices.Geolocation.Geolocator();
// Add event handlers for the statuschanged event.
loc.addEventListener("statuschanged", onStatusChanged);

// Handler for statusChanged event.        
function onStatusChanged(args) {
    var newStatus = args.status;
        document.getElementById('geolocatorStatus').innerHTML =
            getStatusString(newStatus);
}

// display an appropriate error message
function getStatusString(locStatus) {
switch (locStatus) {
    case Windows.Devices.Geolocation.PositionStatus.ready:
        // Location data is available
        return "Location is available.";
                    break;
    case Windows.Devices.Geolocation.PositionStatus.initializing:
         // This status indicates that a location device is still initializing
         return "Location devices are still initializing."; 
         break;
    case Windows.Devices.Geolocation.PositionStatus.noData:
         // No location data is currently available
         return "Data from location services is currently unavailable.";
         break;
    case Windows.Devices.Geolocation.PositionStatus.disabled:
         // The app doesn't have permission to access location,
         // either because location has been turned off.
         return "Your location is currently turned off. " +
             "Change your settings through the Settings charm " +
             " to turn it back on.";
         break;
     case Windows.Devices.Geolocation.PositionStatus.notInitialized:
          // This status indicates that the app has not yet requested
          // location data by calling GetGeolocationAsync() or
          // registering an event handler for the positionChanged event.
          return "Location status is not initialized because " +
                        "the app has not requested location data.";
     case Windows.Devices.Geolocation.PositionStatus.notAvailable:
          // Location is not available on this version of Windows
          return "You do not have the required location services " +
              "present on your system.";
          break;
     default:
          return "Unknown status";
    }
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

None supported [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.Devices.Geolocation
Windows::Devices::Geolocation [C++]

Metadata

Windows.winmd

Capabilities

location
ID_CAP_LOCATION [Windows Phone]

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.