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
4a23a4c6
Commit
4a23a4c6
authored
Feb 26, 2015
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement changePace for Android
parent
6d93955c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
BackgroundGeolocationPlugin.java
src/android/BackgroundGeolocationPlugin.java
+15
-2
No files found.
src/android/BackgroundGeolocationPlugin.java
View file @
4a23a4c6
...
...
@@ -35,6 +35,7 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
public
static
final
String
ACTION_START
=
"start"
;
public
static
final
String
ACTION_STOP
=
"stop"
;
public
static
final
String
ACTION_ON_PACE_CHANGE
=
"onPaceChange"
;
public
static
final
String
ACTION_CONFIGURE
=
"configure"
;
public
static
final
String
ACTION_SET_CONFIG
=
"setConfig"
;
...
...
@@ -94,7 +95,7 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
EventBus
.
getDefault
().
register
(
this
);
}
public
boolean
execute
(
String
action
,
JSONArray
data
,
CallbackContext
callbackContext
)
{
public
boolean
execute
(
String
action
,
JSONArray
data
,
CallbackContext
callbackContext
)
throws
JSONException
{
Log
.
d
(
TAG
,
"execute / action : "
+
action
);
Boolean
result
=
false
;
...
...
@@ -136,6 +137,16 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
}
catch
(
JSONException
e
)
{
callbackContext
.
error
(
"Configuration error "
+
e
.
getMessage
());
}
}
else
if
(
ACTION_ON_PACE_CHANGE
.
equalsIgnoreCase
(
action
))
{
if
(!
isEnabled
)
{
Log
.
w
(
TAG
,
"- Cannot change pace while in #stop mode"
);
result
=
false
;
callbackContext
.
error
(
"Cannot #changePace while in #stop mode"
);
}
else
{
result
=
true
;
isMoving
=
data
.
getBoolean
(
0
);
callbackContext
.
success
();
}
}
else
if
(
ACTION_SET_CONFIG
.
equalsIgnoreCase
(
action
))
{
result
=
true
;
// TODO reconfigure Service
...
...
@@ -188,7 +199,9 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
}
private
void
setPace
(
Boolean
moving
)
{
if
(
moving
)
{
Log
.
i
(
TAG
,
"- setPace: "
+
moving
);
isMoving
=
moving
;
if
(
moving
&&
isEnabled
)
{
LocationRequest
request
=
LocationRequest
.
create
()
.
setPriority
(
translateDesiredAccuracy
(
desiredAccuracy
))
.
setInterval
(
this
.
locationUpdateInterval
)
...
...
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