From a3ed0f61fa2859e5744558149b5e80f1229e33f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastia=CC=81n=20Katzer?= Date: Wed, 9 Oct 2013 14:54:23 +0200 Subject: [PATCH] Release version 0.2.1 --- README.md | 4 ++-- plugin.xml | 6 ++---- src/ios/APPBackgroundMode.h | 6 +++--- src/ios/APPBackgroundMode.m | 34 +++++++++++++++++----------------- www/background-mode.js | 8 ++++---- 5 files changed, 28 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 034b33a..9860735 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ cordova plugin rm de.appplant.cordova.plugin.background-mode ``` ## Release Notes -#### Version 0.2.1 (not yet released) +#### Version 0.2.1 (09.10.2013) - Added js interface to manually enable/disable the background mode. #### Version 0.2.0 (08.10.2013) @@ -29,7 +29,7 @@ cordova plugin rm de.appplant.cordova.plugin.background-mode The plugin turns the app into an location tracking app for the time it runs in the background. ## Using the plugin -Simply add the plugin to your project and the app will run while in background mode. +Simply add the plugin to your project and the app will run while in background. The plugin creates the object ```window.plugin.notification.backgroundMode``` with two methods: diff --git a/plugin.xml b/plugin.xml index 03dcadd..16dd393 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.1"> BackgroundMode @@ -17,7 +17,7 @@ - + @@ -25,7 +25,6 @@ - @@ -64,7 +63,6 @@ - diff --git a/src/ios/APPBackgroundMode.h b/src/ios/APPBackgroundMode.h index 30e1480..72525ed 100644 --- a/src/ios/APPBackgroundMode.h +++ b/src/ios/APPBackgroundMode.h @@ -12,13 +12,13 @@ #import @interface APPBackgroundMode : CDVPlugin { - BOOL _activated; + BOOL _enabled; } // Aktiviert den Hintergrundmodus -- (void) activate:(CDVInvokedUrlCommand *)command; +- (void) enable:(CDVInvokedUrlCommand *)command; // Deaktiviert den Hintergrundmodus -- (void) deactivate:(CDVInvokedUrlCommand *)command; +- (void) disable:(CDVInvokedUrlCommand *)command; @property (nonatomic, strong) CLLocationManager* locationManager; diff --git a/src/ios/APPBackgroundMode.m b/src/ios/APPBackgroundMode.m index fbac767..eec0252 100644 --- a/src/ios/APPBackgroundMode.m +++ b/src/ios/APPBackgroundMode.m @@ -14,9 +14,9 @@ // Registriert die Listener für die (sleep/resume) Events - (void) observeLifeCycle:(CDVInvokedUrlCommand *)command; // Aktiviert den Hintergrundmodus -- (void) activateMode; +- (void) enableMode; // Deaktiviert den Hintergrundmodus -- (void) deactivateMode; +- (void) disableMode; @end @@ -39,9 +39,9 @@ * * Aktiviert den Hintergrundmodus. */ -- (void) activate:(CDVInvokedUrlCommand *)command +- (void) enable:(CDVInvokedUrlCommand *)command { - [self activateMode]; + [self enableMode]; } /** @@ -49,9 +49,9 @@ * * Deaktiviert den Hintergrundmodus. */ -- (void) deactivate:(CDVInvokedUrlCommand *)command +- (void) disable:(CDVInvokedUrlCommand *)command { - [self deactivateMode]; + [self disableMode]; } /** @@ -59,9 +59,9 @@ * * Aktiviert den Hintergrundmodus. */ -- (void) activateMode +- (void) enableMode { - _activated = true; + _enabled = true; } /** @@ -69,9 +69,9 @@ * * Deaktiviert den Hintergrundmodus. */ -- (void) deactivateMode +- (void) disableMode { - _activated = false; + _enabled = false; } /** @@ -79,22 +79,22 @@ */ - (void) pluginInitialize { - [self activateMode]; + [self enableMode]; if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startUpdatingLocation) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopUpdatingLocation) name:UIApplicationWillEnterForegroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(activateMode) name:UIApplicationDidEnterBackgroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deactivateMode) name:UIApplicationWillEnterForegroundNotification object:nil]; } else { - [self startUpdatingLocation]; + [self activateMode]; } } /** * Startet das Aktualisieren des Standpunktes. */ -- (void) startUpdatingLocation +- (void) activateMode { - if (_activated == false) { + if (_enabled == false) { return; }; @@ -115,7 +115,7 @@ /** * Beendet das Aktualisieren des Standpunktes. */ -- (void) stopUpdatingLocation +- (void) deactivateMode { if (locationManager) { // Beendet das Aktualisieren des Standpunktes diff --git a/www/background-mode.js b/www/background-mode.js index 0107061..3825a28 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -18,8 +18,8 @@ BackgroundMode.prototype = { * * Aktiviert den Hintergrundmodus. */ - activate: function () { - cordova.exec(null, null, 'BackgroundMode', 'activate', []); + enable: function () { + cordova.exec(null, null, 'BackgroundMode', 'enable', []); }, /** @@ -27,8 +27,8 @@ BackgroundMode.prototype = { * * Deaktiviert den Hintergrundmodus */ - deactivate: function () { - cordova.exec(null, null, 'BackgroundMode', 'deactivate', []); + disable: function () { + cordova.exec(null, null, 'BackgroundMode', 'disable', []); } };