Release version 0.2.1

This commit is contained in:
Sebastián Katzer 2013-10-09 14:54:23 +02:00
parent dbc16ce72d
commit a3ed0f61fa
5 changed files with 28 additions and 30 deletions

View File

@ -21,7 +21,7 @@ cordova plugin rm de.appplant.cordova.plugin.background-mode
``` ```
## Release Notes ## 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. - Added js interface to manually enable/disable the background mode.
#### Version 0.2.0 (08.10.2013) #### 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. The plugin turns the app into an location tracking app for the time it runs in the background.
## Using the plugin ## 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: The plugin creates the object ```window.plugin.notification.backgroundMode``` with two methods:

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
id="de.appplant.cordova.plugin.background-mode" id="de.appplant.cordova.plugin.background-mode"
version="0.2.0"> version="0.2.1">
<name>BackgroundMode</name> <name>BackgroundMode</name>
@ -17,7 +17,7 @@
</engines> </engines>
<js-module src="www/background-mode.js" name="BackgroundMode"> <js-module src="www/background-mode.js" name="BackgroundMode">
<clobbers target="plugin.notification.BackgroundMode" /> <clobbers target="plugin.notification.backgroundMode" />
</js-module> </js-module>
<!-- ios --> <!-- ios -->
@ -25,7 +25,6 @@
<config-file target="config.xml" parent="/*"> <config-file target="config.xml" parent="/*">
<feature name="BackgroundMode"> <feature name="BackgroundMode">
<param name="ios-package" value="APPBackgroundMode"/> <param name="ios-package" value="APPBackgroundMode"/>
<!-- Needs to be initialiced onload since the plugin has no callable js interface -->
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
</config-file> </config-file>
@ -64,7 +63,6 @@
<config-file target="config.xml" parent="/*"> <config-file target="config.xml" parent="/*">
<feature name="BackgroundMode"> <feature name="BackgroundMode">
<param name="wp-package" value="APPPlant.Cordova.Plugin.BackgroundMode"/> <param name="wp-package" value="APPPlant.Cordova.Plugin.BackgroundMode"/>
<!-- Needs to be initialiced onload since the plugin has no callable js interface -->
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
</config-file> </config-file>

View File

@ -12,13 +12,13 @@
#import <CoreLocation/CoreLocation.h> #import <CoreLocation/CoreLocation.h>
@interface APPBackgroundMode : CDVPlugin { @interface APPBackgroundMode : CDVPlugin {
BOOL _activated; BOOL _enabled;
} }
// Aktiviert den Hintergrundmodus // Aktiviert den Hintergrundmodus
- (void) activate:(CDVInvokedUrlCommand *)command; - (void) enable:(CDVInvokedUrlCommand *)command;
// Deaktiviert den Hintergrundmodus // Deaktiviert den Hintergrundmodus
- (void) deactivate:(CDVInvokedUrlCommand *)command; - (void) disable:(CDVInvokedUrlCommand *)command;
@property (nonatomic, strong) CLLocationManager* locationManager; @property (nonatomic, strong) CLLocationManager* locationManager;

View File

@ -14,9 +14,9 @@
// Registriert die Listener für die (sleep/resume) Events // Registriert die Listener für die (sleep/resume) Events
- (void) observeLifeCycle:(CDVInvokedUrlCommand *)command; - (void) observeLifeCycle:(CDVInvokedUrlCommand *)command;
// Aktiviert den Hintergrundmodus // Aktiviert den Hintergrundmodus
- (void) activateMode; - (void) enableMode;
// Deaktiviert den Hintergrundmodus // Deaktiviert den Hintergrundmodus
- (void) deactivateMode; - (void) disableMode;
@end @end
@ -39,9 +39,9 @@
* *
* Aktiviert den Hintergrundmodus. * Aktiviert den Hintergrundmodus.
*/ */
- (void) activate:(CDVInvokedUrlCommand *)command - (void) enable:(CDVInvokedUrlCommand *)command
{ {
[self activateMode]; [self enableMode];
} }
/** /**
@ -49,9 +49,9 @@
* *
* Deaktiviert den Hintergrundmodus. * Deaktiviert den Hintergrundmodus.
*/ */
- (void) deactivate:(CDVInvokedUrlCommand *)command - (void) disable:(CDVInvokedUrlCommand *)command
{ {
[self deactivateMode]; [self disableMode];
} }
/** /**
@ -59,9 +59,9 @@
* *
* Aktiviert den Hintergrundmodus. * Aktiviert den Hintergrundmodus.
*/ */
- (void) activateMode - (void) enableMode
{ {
_activated = true; _enabled = true;
} }
/** /**
@ -69,9 +69,9 @@
* *
* Deaktiviert den Hintergrundmodus. * Deaktiviert den Hintergrundmodus.
*/ */
- (void) deactivateMode - (void) disableMode
{ {
_activated = false; _enabled = false;
} }
/** /**
@ -79,22 +79,22 @@
*/ */
- (void) pluginInitialize - (void) pluginInitialize
{ {
[self activateMode]; [self enableMode];
if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) { if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startUpdatingLocation) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(activateMode) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopUpdatingLocation) name:UIApplicationWillEnterForegroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deactivateMode) name:UIApplicationWillEnterForegroundNotification object:nil];
} else { } else {
[self startUpdatingLocation]; [self activateMode];
} }
} }
/** /**
* Startet das Aktualisieren des Standpunktes. * Startet das Aktualisieren des Standpunktes.
*/ */
- (void) startUpdatingLocation - (void) activateMode
{ {
if (_activated == false) { if (_enabled == false) {
return; return;
}; };
@ -115,7 +115,7 @@
/** /**
* Beendet das Aktualisieren des Standpunktes. * Beendet das Aktualisieren des Standpunktes.
*/ */
- (void) stopUpdatingLocation - (void) deactivateMode
{ {
if (locationManager) { if (locationManager) {
// Beendet das Aktualisieren des Standpunktes // Beendet das Aktualisieren des Standpunktes

View File

@ -18,8 +18,8 @@ BackgroundMode.prototype = {
* *
* Aktiviert den Hintergrundmodus. * Aktiviert den Hintergrundmodus.
*/ */
activate: function () { enable: function () {
cordova.exec(null, null, 'BackgroundMode', 'activate', []); cordova.exec(null, null, 'BackgroundMode', 'enable', []);
}, },
/** /**
@ -27,8 +27,8 @@ BackgroundMode.prototype = {
* *
* Deaktiviert den Hintergrundmodus * Deaktiviert den Hintergrundmodus
*/ */
deactivate: function () { disable: function () {
cordova.exec(null, null, 'BackgroundMode', 'deactivate', []); cordova.exec(null, null, 'BackgroundMode', 'disable', []);
} }
}; };