diff --git a/src/wp8/BackgroundMode.cs b/src/wp8/BackgroundMode.cs index 7f1cf67..55b5004 100644 --- a/src/wp8/BackgroundMode.cs +++ b/src/wp8/BackgroundMode.cs @@ -86,7 +86,7 @@ namespace Cordova.Extension.Commands /// public static void Activate () { - if (Geolocator == null && isEnabled) + if (Geolocator == null && isEnabled && IsServiceAvailable()) { Geolocator = new Geolocator(); @@ -109,5 +109,13 @@ namespace Cordova.Extension.Commands } private static void geolocator_PositionChanged (Geolocator sender, PositionChangedEventArgs args) {} + + /// + /// Gibt an, ob der Lokalisierungsdienst verfügbar ist + /// + private static bool IsServiceAvailable() + { + return !(Geolocator.LocationStatus == PositionStatus.Disabled || Geolocator.LocationStatus == PositionStatus.NotAvailable); + } } }