From 8540a46ef269c1f5e3c44e63cca5b75e316d455c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Thu, 10 Oct 2013 12:38:32 +0200 Subject: [PATCH] Added details about WP8 --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1745710..c448a34 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ by Sebastián Katzer ([github.com/katzer](https://github.com/katzer)) ## Supported Platforms - **iOS** (>=5) +- **WP8** ## Adding the Plugin to your project Through the [Command-line Interface](http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface): @@ -21,6 +22,10 @@ cordova plugin rm de.appplant.cordova.plugin.background-mode ``` ## Release Notes +#### Version 0.2.1 (not yet released) +- Added WP8 support
+ The plugin turns the app into an location tracking app *(for the time it runs in the background)*. + #### Version 0.2.1 (09.10.2013) - Added js interface to manually enable/disable the background mode. @@ -37,12 +42,6 @@ The plugin creates the object ```window.plugin.backgroundMode``` with two method The method enables the background mode. The mode is activated once the app has entered the background and will be deactivated after the app has entered the foreground.
Please be aware, to activate the background mode the app needs to be in foreground. -**iOS 5-6**
-The app still runs in background, even if the location service is not active. - -**iOS 7**
-The location service needs to be enabled. - ```javascript /** * Enables the background mode. The app will not pause while in background. @@ -75,3 +74,38 @@ to NSMainNibFile ``` + +### Location tracking under iOS +**iOS 5-6**
+The app still runs in background, even if the location service is not actived. + +**iOS 7**
+The location service needs to be enabled. + +### Optimization under WP8 +By default the plugin will track for geo updates while the application is in background and foreground. To stop tracking in foreground, the `MainPage.xaml.cs` file needs the following 2 methods: +```c# +namespace your.own.namespace +{ + public partial class MainPage : PhoneApplicationPage + { + /// + /// The page (the app) will enter the background and the background mode + /// needs to be activated. + /// + protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e) + { + Cordova.Extension.Commands.BackgroundMode.Activate(); + } + + /// + /// The page (the app) will enter the foreground and the background mode + /// needs to be deactivated. + /// + protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) + { + Cordova.Extension.Commands.BackgroundMode.Deactivate(); + } + } +} +```