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
1de965b3
Commit
1de965b3
authored
Mar 20, 2014
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move stationary-monitor block into BraodcastReceiver. Increase stationary-monitor rate to 3min
parent
bd19c13b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
LocationUpdateService.java
src/android/LocationUpdateService.java
+9
-12
No files found.
src/android/LocationUpdateService.java
View file @
1de965b3
...
@@ -60,7 +60,7 @@ public class LocationUpdateService extends Service implements LocationListener {
...
@@ -60,7 +60,7 @@ public class LocationUpdateService extends Service implements LocationListener {
private
static
final
String
SINGLE_LOCATION_UPDATE_ACTION
=
"com.tenforwardconsulting.cordova.bgloc.SINGLE_LOCATION_UPDATE_ACTION"
;
private
static
final
String
SINGLE_LOCATION_UPDATE_ACTION
=
"com.tenforwardconsulting.cordova.bgloc.SINGLE_LOCATION_UPDATE_ACTION"
;
private
static
final
String
STATIONARY_LOCATION_MONITOR_ACTION
=
"com.tenforwardconsulting.cordova.bgloc.STATIONARY_LOCATION_MONITOR_ACTION"
;
private
static
final
String
STATIONARY_LOCATION_MONITOR_ACTION
=
"com.tenforwardconsulting.cordova.bgloc.STATIONARY_LOCATION_MONITOR_ACTION"
;
private
static
final
long
STATIONARY_TIMEOUT
=
5
*
1000
*
60
;
// 5 minutes.
private
static
final
long
STATIONARY_TIMEOUT
=
5
*
1000
*
60
;
// 5 minutes.
private
static
final
long
STATIONARY_MONITOR_POLL_INTERVAL
=
1
*
1000
*
3
0
;
//3 * 1000 * 60; // 3 minutes.
private
static
final
long
STATIONARY_MONITOR_POLL_INTERVAL
=
3
*
1000
*
6
0
;
//3 * 1000 * 60; // 3 minutes.
private
static
final
Integer
MAX_STATIONARY_ACQUISITION_ATTEMPTS
=
5
;
private
static
final
Integer
MAX_STATIONARY_ACQUISITION_ATTEMPTS
=
5
;
private
static
final
Integer
MAX_SPEED_ACQUISITION_ATTEMPTS
=
3
;
private
static
final
Integer
MAX_SPEED_ACQUISITION_ATTEMPTS
=
3
;
...
@@ -398,16 +398,6 @@ public class LocationUpdateService extends Service implements LocationListener {
...
@@ -398,16 +398,6 @@ public class LocationUpdateService extends Service implements LocationListener {
return
;
return
;
}
}
}
else
if
(
stationaryLocation
!=
null
)
{
}
else
if
(
stationaryLocation
!=
null
)
{
float
distance
=
location
.
distanceTo
(
stationaryLocation
)
-
stationaryLocation
.
getAccuracy
()
-
location
.
getAccuracy
();
Toast
.
makeText
(
this
,
"DISTANCE: "
+
distance
,
Toast
.
LENGTH_LONG
).
show
();
Log
.
i
(
TAG
,
"- distance from stationary location: "
+
distance
);
if
(
distance
>
stationaryRadius
)
{
if
(
isDebugging
)
{
Toast
.
makeText
(
this
,
"MANUAL STATIONARY EXIT: "
+
distance
,
Toast
.
LENGTH_LONG
).
show
();
}
onExitStationaryRegion
(
location
);
}
return
;
return
;
}
}
// Go ahead and cache, push to server
// Go ahead and cache, push to server
...
@@ -529,8 +519,15 @@ public class LocationUpdateService extends Service implements LocationListener {
...
@@ -529,8 +519,15 @@ public class LocationUpdateService extends Service implements LocationListener {
String
key
=
LocationManager
.
KEY_LOCATION_CHANGED
;
String
key
=
LocationManager
.
KEY_LOCATION_CHANGED
;
Location
location
=
(
Location
)
intent
.
getExtras
().
get
(
key
);
Location
location
=
(
Location
)
intent
.
getExtras
().
get
(
key
);
if
(
location
!=
null
)
{
if
(
location
!=
null
)
{
startTone
(
"beep"
);
Log
.
d
(
TAG
,
"- singleUpdateReciever"
+
location
.
toString
());
Log
.
d
(
TAG
,
"- singleUpdateReciever"
+
location
.
toString
());
onLocationChanged
(
location
);
float
distance
=
location
.
distanceTo
(
stationaryLocation
)
-
stationaryLocation
.
getAccuracy
()
-
location
.
getAccuracy
();
// TODO http://www.cse.buffalo.edu/~demirbas/publications/proximity.pdf
// determine if we're almost out of stationary-distance and increase monitoring-rate.
Log
.
i
(
TAG
,
"- distance from stationary location: "
+
distance
);
if
(
distance
>
stationaryRadius
)
{
onExitStationaryRegion
(
location
);
}
}
}
}
}
};
};
...
...
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