Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cordova-background-geolocation
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Aksimaya
cordova-background-geolocation
Commits
6539611a
Commit
6539611a
authored
Apr 24, 2015
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More de-coupling of core lib from Cordova
parent
3d031b3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
27 deletions
+8
-27
BackgroundGeolocation.h
src/ios/BackgroundGeolocation.h
+0
-1
BackgroundGeolocation.m
src/ios/BackgroundGeolocation.m
+6
-20
CDVBackgroundGeoLocation.m
src/ios/CDVBackgroundGeoLocation.m
+2
-6
No files found.
src/ios/BackgroundGeolocation.h
View file @
6539611a
#import <CoreLocation/CoreLocation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <Cordova/CDVCommandDelegate.h>
@interface
BackgroundGeolocation
:
NSObject
<
CLLocationManagerDelegate
>
...
...
src/ios/BackgroundGeolocation.m
View file @
6539611a
...
...
@@ -6,8 +6,6 @@
//
//
#import "BackgroundGeolocation.h"
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDVJSON.h>
// Debug sounds for bg-geolocation life-cycle events.
// http://iphonedevwiki.net/index.php/AudioServices
...
...
@@ -61,12 +59,8 @@
CLLocationAccuracy
desiredAccuracy
;
CLActivityType
activityType
;
BOOL
disableElasticity
;
}
//@synthesize syncCallbackId, stationaryRegionListeners, commandDelegate;
-
(
id
)
init
{
locationManager
=
[[
CLLocationManager
alloc
]
init
];
...
...
@@ -231,19 +225,6 @@
}
}
-
(
void
)
addStationaryRegionListener
:(
CDVInvokedUrlCommand
*
)
command
{
/*
if (self.stationaryRegionListeners == nil) {
self.stationaryRegionListeners = [[NSMutableArray alloc] init];
}
[self.stationaryRegionListeners addObject:command.callbackId];
if (stationaryRegion) {
[self queue:stationaryLocation type:@"stationary"];
}
*/
}
/**
* Suspend. Turn on passive location services
*/
...
...
@@ -473,12 +454,17 @@
// Create a background-task and delegate to Javascript for syncing location
bgTask
=
[
self
createBackgroundTask
];
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
runInBackground
:
^
{
[
self
sync
:
data
];
}];
}
}
-
(
void
)
runInBackground
:(
void
(
^
)())
block
{
dispatch_async
(
dispatch_get_global_queue
(
DISPATCH_QUEUE_PRIORITY_DEFAULT
,
0
),
block
);
}
/**
* We are running in the background if this is being executed.
* We can't assume normal network access.
...
...
src/ios/CDVBackgroundGeoLocation.m
View file @
6539611a
...
...
@@ -16,7 +16,6 @@
-
(
void
)
pluginInitialize
{
bgGeo
=
[[
BackgroundGeolocation
alloc
]
init
];
bgGeo
.
commandDelegate
=
self
.
commandDelegate
;
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
onLocationChanged
:
)
name
:
@"BackgroundGeolocation.location"
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
onStationaryLocation
:
)
name
:
@"BackgroundGeolocation.stationarylocation"
object
:
nil
];
...
...
@@ -96,21 +95,18 @@
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsDictionary
:
locationData
];
[
result
setKeepCallbackAsBool
:
YES
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
self
.
syncCallbackId
];
NSLog
(
@"-------------------------------onLocation %@"
,
locationData
);
}
-
(
void
)
onStationaryLocation
:(
NSNotification
*
)
notification
{
NSMutableDictionary
*
data
=
notification
.
object
;
NSLog
(
@"-------------------------------onStationaryLocation %@"
,
data
);
NSMutableDictionary
*
locationData
=
notification
.
object
;
if
(
!
[
self
.
stationaryRegionListeners
count
])
{
[
bgGeo
stopBackgroundTask
];
return
;
}
CDVPluginResult
*
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsDictionary
:
d
ata
];
CDVPluginResult
*
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsDictionary
:
locationD
ata
];
[
result
setKeepCallbackAsBool
:
YES
];
for
(
NSString
*
callbackId
in
self
.
stationaryRegionListeners
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment