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
e09a4fb8
Commit
e09a4fb8
authored
Dec 17, 2013
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make desiredAccuracy configurable
parent
da01e7f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
CDVBackgroundGeoLocation.m
src/ios/CDVBackgroundGeoLocation.m
+21
-1
BackgroundGeoLocation.js
www/BackgroundGeoLocation.js
+3
-2
No files found.
src/ios/CDVBackgroundGeoLocation.m
View file @
e09a4fb8
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
NSInteger
stationaryRadius
;
NSInteger
stationaryRadius
;
NSInteger
distanceFilter
;
NSInteger
distanceFilter
;
NSInteger
locationTimeout
;
NSInteger
locationTimeout
;
NSInteger
desiredAccuracy
;
}
}
-
(
void
)
pluginInitialize
-
(
void
)
pluginInitialize
...
@@ -45,6 +46,7 @@
...
@@ -45,6 +46,7 @@
* @param {Number} stationaryRadius
* @param {Number} stationaryRadius
* @param {Number} distanceFilter
* @param {Number} distanceFilter
* @param {Number} locationTimeout
* @param {Number} locationTimeout
* @param {Number} desiredAccuracy
*/
*/
-
(
void
)
configure
:(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
configure
:(
CDVInvokedUrlCommand
*
)
command
{
{
...
@@ -56,12 +58,29 @@
...
@@ -56,12 +58,29 @@
stationaryRadius
=
[[
command
.
arguments
objectAtIndex
:
2
]
intValue
];
stationaryRadius
=
[[
command
.
arguments
objectAtIndex
:
2
]
intValue
];
distanceFilter
=
[[
command
.
arguments
objectAtIndex
:
3
]
intValue
];
distanceFilter
=
[[
command
.
arguments
objectAtIndex
:
3
]
intValue
];
locationTimeout
=
[[
command
.
arguments
objectAtIndex
:
4
]
intValue
];
locationTimeout
=
[[
command
.
arguments
objectAtIndex
:
4
]
intValue
];
desiredAccuracy
=
[[
command
.
arguments
objectAtIndex
:
5
]
intValue
];
syncCallbackId
=
command
.
callbackId
;
syncCallbackId
=
command
.
callbackId
;
// Set a movement threshold for new events.
// Set a movement threshold for new events.
locationManager
.
activityType
=
CLActivityTypeOther
;
locationManager
.
activityType
=
CLActivityTypeOther
;
locationManager
.
pausesLocationUpdatesAutomatically
=
YES
;
locationManager
.
pausesLocationUpdatesAutomatically
=
YES
;
switch
(
desiredAccuracy
)
{
case
1000
:
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyKilometer
;
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyKilometer
;
break
;
case
100
:
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyHundredMeters
;
break
;
case
10
:
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyNearestTenMeters
;
break
;
case
0
:
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyBest
;
break
;
}
locationManager
.
distanceFilter
=
distanceFilter
;
// meters
locationManager
.
distanceFilter
=
distanceFilter
;
// meters
myRegion
=
nil
;
myRegion
=
nil
;
...
@@ -72,6 +91,7 @@
...
@@ -72,6 +91,7 @@
NSLog
(
@" - distanceFilter: %ld"
,
(
long
)
distanceFilter
);
NSLog
(
@" - distanceFilter: %ld"
,
(
long
)
distanceFilter
);
NSLog
(
@" - stationaryRadius: %ld"
,
(
long
)
stationaryRadius
);
NSLog
(
@" - stationaryRadius: %ld"
,
(
long
)
stationaryRadius
);
NSLog
(
@" - locationTimeout: %ld"
,
(
long
)
locationTimeout
);
NSLog
(
@" - locationTimeout: %ld"
,
(
long
)
locationTimeout
);
NSLog
(
@" - desiredAccuracy: %ld"
,
(
long
)
desiredAccuracy
);
}
}
/**
/**
* Turn on background geolocation
* Turn on background geolocation
...
...
www/BackgroundGeoLocation.js
View file @
e09a4fb8
...
@@ -29,13 +29,14 @@ module.exports = {
...
@@ -29,13 +29,14 @@ module.exports = {
url
=
config
.
url
||
'
BackgroundGeoLocation_url
'
,
url
=
config
.
url
||
'
BackgroundGeoLocation_url
'
,
stationaryRadius
=
config
.
stationaryRadius
||
50
,
// meters
stationaryRadius
=
config
.
stationaryRadius
||
50
,
// meters
distanceFilter
=
config
.
distanceFilter
||
500
,
// meters
distanceFilter
=
config
.
distanceFilter
||
500
,
// meters
locationTimeout
=
config
.
locationTimeout
||
60
;
// seconds
locationTimeout
=
config
.
locationTimeout
||
60
,
// seconds
desiredAccuracy
=
config
.
desiredAccuracy
||
100
;
// meters
exec
(
success
||
function
()
{},
exec
(
success
||
function
()
{},
failure
||
function
()
{},
failure
||
function
()
{},
'
BackgroundGeoLocation
'
,
'
BackgroundGeoLocation
'
,
'
configure
'
,
'
configure
'
,
[
authToken
,
url
,
stationaryRadius
,
distanceFilter
,
locationTimeout
]);
[
authToken
,
url
,
stationaryRadius
,
distanceFilter
,
locationTimeout
,
desiredAccuracy
]);
},
},
start
:
function
(
success
,
failure
,
config
)
{
start
:
function
(
success
,
failure
,
config
)
{
exec
(
success
||
function
()
{},
exec
(
success
||
function
()
{},
...
...
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