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
f0fdd64d
Commit
f0fdd64d
authored
May 20, 2014
by
Zachary Giles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish headers
parent
a9999168
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
BackgroundGpsPlugin.java
src/android/BackgroundGpsPlugin.java
+11
-8
LocationUpdateService.java
src/android/LocationUpdateService.java
+4
-2
No files found.
src/android/BackgroundGpsPlugin.java
View file @
f0fdd64d
...
...
@@ -25,6 +25,7 @@ public class BackgroundGpsPlugin extends CordovaPlugin {
private
String
url
;
private
String
params
;
private
String
headers
;
private
String
stationaryRadius
=
"30"
;
private
String
desiredAccuracy
=
"100"
;
private
String
distanceFilter
=
"30"
;
...
...
@@ -38,12 +39,13 @@ public class BackgroundGpsPlugin extends CordovaPlugin {
if
(
ACTION_START
.
equalsIgnoreCase
(
action
)
&&
!
isEnabled
)
{
result
=
true
;
if
(
params
==
null
||
url
==
null
)
{
if
(
params
==
null
||
headers
==
null
||
url
==
null
)
{
callbackContext
.
error
(
"Call configure before calling start"
);
}
else
{
callbackContext
.
success
();
updateServiceIntent
.
putExtra
(
"url"
,
url
);
updateServiceIntent
.
putExtra
(
"params"
,
params
);
updateServiceIntent
.
putExtra
(
"headers"
,
headers
);
updateServiceIntent
.
putExtra
(
"stationaryRadius"
,
stationaryRadius
);
updateServiceIntent
.
putExtra
(
"desiredAccuracy"
,
desiredAccuracy
);
updateServiceIntent
.
putExtra
(
"distanceFilter"
,
distanceFilter
);
...
...
@@ -62,14 +64,15 @@ public class BackgroundGpsPlugin extends CordovaPlugin {
}
else
if
(
ACTION_CONFIGURE
.
equalsIgnoreCase
(
action
))
{
result
=
true
;
try
{
// [params, url, stationaryRadius, distanceFilter, locationTimeout, desiredAccuracy, debug]);
// [params,
headers
url, stationaryRadius, distanceFilter, locationTimeout, desiredAccuracy, debug]);
this
.
params
=
data
.
getString
(
0
);
this
.
url
=
data
.
getString
(
1
);
this
.
stationaryRadius
=
data
.
getString
(
2
);
this
.
distanceFilter
=
data
.
getString
(
3
);
this
.
locationTimeout
=
data
.
getString
(
4
);
this
.
desiredAccuracy
=
data
.
getString
(
5
);
this
.
isDebugging
=
data
.
getString
(
6
);
this
.
headers
=
data
.
getString
(
1
);
this
.
url
=
data
.
getString
(
2
);
this
.
stationaryRadius
=
data
.
getString
(
3
);
this
.
distanceFilter
=
data
.
getString
(
4
);
this
.
locationTimeout
=
data
.
getString
(
5
);
this
.
desiredAccuracy
=
data
.
getString
(
6
);
this
.
isDebugging
=
data
.
getString
(
7
);
}
catch
(
JSONException
e
)
{
callbackContext
.
error
(
"authToken/url required as parameters: "
+
e
.
getMessage
());
...
...
src/android/LocationUpdateService.java
View file @
f0fdd64d
...
...
@@ -665,11 +665,13 @@ public class LocationUpdateService extends Service implements LocationListener {
StringEntity
se
=
new
StringEntity
(
params
.
toString
());
request
.
setEntity
(
se
);
request
.
setHeader
(
"Accept"
,
"application/json"
);
request
.
setHeader
(
"Content-type"
,
"application/json"
);
Iterator
<
String
>
headkeys
=
headers
.
keys
();
while
(
headkeys
.
hasNext
()
){
if
(
headkeys
.
next
()
!=
null
)
{
String
headkey
=
(
String
)
headkeys
.
next
();
String
headkey
=
headkeys
.
next
();
if
(
headkey
!=
null
)
{
Log
.
d
(
TAG
,
"Adding Header: "
+
headkey
+
" : "
+
(
String
)
headers
.
getString
(
headkey
));
request
.
setHeader
(
headkey
,
(
String
)
headers
.
getString
(
headkey
));
}
...
...
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