Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cordova-plugin-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-plugin-background-geolocation
Commits
8949787b
Commit
8949787b
authored
Feb 11, 2014
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vary distanceFilter exponentially with speed, capped to 1000
parent
cff6468f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
CDVBackgroundGeoLocation.m
src/ios/CDVBackgroundGeoLocation.m
+7
-4
No files found.
src/ios/CDVBackgroundGeoLocation.m
View file @
8949787b
...
@@ -235,11 +235,12 @@
...
@@ -235,11 +235,12 @@
-
(
void
)
locationManager
:(
CLLocationManager
*
)
manager
didUpdateLocations
:(
NSArray
*
)
locations
-
(
void
)
locationManager
:(
CLLocationManager
*
)
manager
didUpdateLocations
:(
NSArray
*
)
locations
{
{
NSLog
(
@"- CDVBackgroundGeoLocation didUpdateLocations (isMoving: %hhd)"
,
isMoving
);
NSLog
(
@"- CDVBackgroundGeoLocation didUpdateLocations (isMoving: %hhd)"
,
isMoving
);
CLLocation
*
newLocation
=
[
locations
lastObject
];
if
(
!
isMoving
&&
!
isAcquiringStationaryLocation
&&
!
stationaryLocation
)
{
if
(
!
isMoving
&&
!
isAcquiringStationaryLocation
&&
!
stationaryLocation
)
{
// Perhaps our GPS signal was interupted, re-acquire a stationaryLocation now.
// Perhaps our GPS signal was interupted, re-acquire a stationaryLocation now.
[
self
setPace
:
NO
];
[
self
setPace
:
NO
];
}
}
CLLocation
*
newLocation
=
[
locations
lastObject
];
// Handle location updates as normal, code omitted for brevity.
// Handle location updates as normal, code omitted for brevity.
// The omitted code should determine whether to reject the location update for being too
// The omitted code should determine whether to reject the location update for being too
...
@@ -362,10 +363,12 @@
...
@@ -362,10 +363,12 @@
{
{
float
newDistanceFilter
=
distanceFilter
;
float
newDistanceFilter
=
distanceFilter
;
if
(
velocity
>
5
.
0
&&
velocity
<
100
)
{
if
(
velocity
>
3
.
0
&&
velocity
<
100
)
{
newDistanceFilter
=
(
5
.
0
*
floorf
(
velocity
/
5
.
0
+
0
.
5
f
))
*
10
;
// (rounded-velocity-to-nearest-5) / 2)^2
// eg 5.2 becomes (5/2)^2
newDistanceFilter
=
pow
((
5
.
0
*
floorf
(
velocity
/
5
.
0
+
0
.
5
f
)),
2
)
+
distanceFilter
;
}
}
return
newDistanceFilter
;
return
(
newDistanceFilter
<
1000
)
?
newDistanceFilter
:
1000
;
}
}
-
(
void
)
stopBackgroundTask
-
(
void
)
stopBackgroundTask
...
...
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