mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2024-12-23 13:57:35 +00:00
Release version 0.2.1
This commit is contained in:
parent
dbc16ce72d
commit
a3ed0f61fa
@ -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:
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||
id="de.appplant.cordova.plugin.background-mode"
|
||||
version="0.2.0">
|
||||
version="0.2.1">
|
||||
|
||||
<name>BackgroundMode</name>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
</engines>
|
||||
|
||||
<js-module src="www/background-mode.js" name="BackgroundMode">
|
||||
<clobbers target="plugin.notification.BackgroundMode" />
|
||||
<clobbers target="plugin.notification.backgroundMode" />
|
||||
</js-module>
|
||||
|
||||
<!-- ios -->
|
||||
@ -25,7 +25,6 @@
|
||||
<config-file target="config.xml" parent="/*">
|
||||
<feature name="BackgroundMode">
|
||||
<param name="ios-package" value="APPBackgroundMode"/>
|
||||
<!-- Needs to be initialiced onload since the plugin has no callable js interface -->
|
||||
<param name="onload" value="true" />
|
||||
</feature>
|
||||
</config-file>
|
||||
@ -64,7 +63,6 @@
|
||||
<config-file target="config.xml" parent="/*">
|
||||
<feature name="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" />
|
||||
</feature>
|
||||
</config-file>
|
||||
|
@ -12,13 +12,13 @@
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
@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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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', []);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user