mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2025-12-13 09:53:22 +00:00
Added js interface
This commit is contained in:
@@ -14,9 +14,9 @@
|
||||
@interface APPBackgroundMode : CDVPlugin
|
||||
|
||||
// Aktiviert den Hintergrundmodus
|
||||
- (void) activateMode;
|
||||
- (void) activate:(CDVInvokedUrlCommand *)command;
|
||||
// Deaktiviert den Hintergrundmodus
|
||||
- (void) deactivateMode;
|
||||
- (void) deactivate:(CDVInvokedUrlCommand *)command;
|
||||
|
||||
@property (nonatomic, strong) CLLocationManager* locationManager;
|
||||
|
||||
|
||||
@@ -9,11 +9,44 @@
|
||||
|
||||
#import "APPBackgroundMode.h"
|
||||
|
||||
@interface APPBackgroundMode (PrivateMethods)
|
||||
|
||||
// Aktiviert den Hintergrundmodus
|
||||
- (void) activateMode;
|
||||
// Deaktiviert den Hintergrundmodus
|
||||
- (void) deactivateMode;
|
||||
|
||||
@end
|
||||
|
||||
@implementation APPBackgroundMode
|
||||
|
||||
@synthesize locationManager;
|
||||
|
||||
// Aktiviert den Hintergrundmodus
|
||||
/**
|
||||
* @js-interface
|
||||
*
|
||||
* Aktiviert den Hintergrundmodus.
|
||||
*/
|
||||
- (void) activate:(CDVInvokedUrlCommand *)command
|
||||
{
|
||||
[self activateMode];
|
||||
}
|
||||
|
||||
/**
|
||||
* @js-interface
|
||||
*
|
||||
* Deaktiviert den Hintergrundmodus.
|
||||
*/
|
||||
- (void) deactivate:(CDVInvokedUrlCommand *)command
|
||||
{
|
||||
[self deactivateMode];
|
||||
}
|
||||
|
||||
/**
|
||||
* @obj-c-interface
|
||||
*
|
||||
* Aktiviert den Hintergrundmodus.
|
||||
*/
|
||||
- (void) activateMode
|
||||
{
|
||||
if (!locationManager) {
|
||||
@@ -30,7 +63,11 @@
|
||||
[locationManager startUpdatingLocation];
|
||||
}
|
||||
|
||||
// Deaktiviert den Hintergrundmodus
|
||||
/**
|
||||
* @obj-c-interface
|
||||
*
|
||||
* Deaktiviert den Hintergrundmodus.
|
||||
*/
|
||||
- (void) deactivateMode
|
||||
{
|
||||
if (locationManager) {
|
||||
@@ -38,7 +75,9 @@
|
||||
};
|
||||
}
|
||||
|
||||
// Registriert sich für die (sleep/resume) Events und startet bzw. stoppt die Geo-Lokalisierung
|
||||
/**
|
||||
* Registriert die Listener für die (sleep/resume) Events und startet bzw. stoppt die Geo-Lokalisierung.
|
||||
*/
|
||||
- (void) pluginInitialize
|
||||
{
|
||||
if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
|
||||
|
||||
Reference in New Issue
Block a user