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
43181dc6
Commit
43181dc6
authored
Feb 26, 2014
by
Chris Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix param config. turn on persistence
parent
1d6809de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
27 deletions
+17
-27
LocationUpdateService.java
src/android/LocationUpdateService.java
+17
-27
No files found.
src/android/LocationUpdateService.java
View file @
43181dc6
...
@@ -116,34 +116,24 @@ public class LocationUpdateService extends Service implements LocationListener {
...
@@ -116,34 +116,24 @@ public class LocationUpdateService extends Service implements LocationListener {
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
Log
.
i
(
TAG
,
"Received start id "
+
startId
+
": "
+
intent
);
Log
.
i
(
TAG
,
"Received start id "
+
startId
+
": "
+
intent
);
if
(
intent
!=
null
)
{
if
(
intent
!=
null
)
{
this
.
authToken
=
intent
.
getStringExtra
(
"authToken"
);
authToken
=
intent
.
getStringExtra
(
"authToken"
);
this
.
url
=
intent
.
getStringExtra
(
"url"
);
url
=
intent
.
getStringExtra
(
"url"
);
this
.
stationaryRadius
=
Float
.
parseFloat
(
intent
.
getStringExtra
(
"stationaryRadius"
));
stationaryRadius
=
Float
.
parseFloat
(
intent
.
getStringExtra
(
"stationaryRadius"
));
distanceFilter
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
"distanceFilter"
));
distanceFilter
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
"distanceFilter"
));
if
(
distanceFilter
==
null
)
{
desiredAccuracy
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
"desiredAccuracy"
));
distanceFilter
=
30
;
locationTimeout
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
"locationTimeout"
));
}
isDebugging
=
Boolean
.
parseBoolean
(
intent
.
getStringExtra
(
"isDebugging"
));
this
.
desiredAccuracy
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
"desiredAccuracy"
));
if
(
desiredAccuracy
==
null
)
{
if
(
isDebugging
)
{
desiredAccuracy
=
100
;
}
this
.
locationTimeout
=
Integer
.
parseInt
(
intent
.
getStringExtra
(
"locationTimeout"
));
if
(
locationTimeout
==
null
)
{
locationTimeout
=
60
;
}
this
.
isDebugging
=
Boolean
.
parseBoolean
(
intent
.
getStringExtra
(
"isDebugging"
));
if
(
this
.
isDebugging
==
null
)
{
this
.
isDebugging
=
false
;
}
if
(
this
.
isDebugging
)
{
toneGenerator
=
new
ToneGenerator
(
AudioManager
.
STREAM_NOTIFICATION
,
100
);
toneGenerator
=
new
ToneGenerator
(
AudioManager
.
STREAM_NOTIFICATION
,
100
);
}
}
Log
.
i
(
TAG
,
"- stationaryRadius: "
+
stationaryRadius
);
Log
.
i
(
TAG
,
"- url: "
+
url
);
Log
.
i
(
TAG
,
"- distanceFilter: "
+
distanceFilter
);
Log
.
i
(
TAG
,
"- token: "
+
authToken
);
Log
.
i
(
TAG
,
"- desiredAccuracy: "
+
desiredAccuracy
);
Log
.
i
(
TAG
,
"- stationaryRadius: "
+
stationaryRadius
);
Log
.
i
(
TAG
,
"- locationTimeout: "
+
locationTimeout
);
Log
.
i
(
TAG
,
"- distanceFilter: "
+
distanceFilter
);
Log
.
i
(
TAG
,
"- isDebugging: "
+
isDebugging
);
Log
.
i
(
TAG
,
"- desiredAccuracy: "
+
desiredAccuracy
);
Log
.
i
(
TAG
,
"- locationTimeout: "
+
locationTimeout
);
Log
.
i
(
TAG
,
"- isDebugging: "
+
isDebugging
);
}
}
Toast
.
makeText
(
this
,
"Background location tracking started"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
this
,
"Background location tracking started"
,
Toast
.
LENGTH_SHORT
).
show
();
...
@@ -301,11 +291,11 @@ public class LocationUpdateService extends Service implements LocationListener {
...
@@ -301,11 +291,11 @@ public class LocationUpdateService extends Service implements LocationListener {
// test the measurement to see if it is more accurate than the previous measurement
// test the measurement to see if it is more accurate than the previous measurement
//
persistLocation(location);
persistLocation
(
location
);
if
(
this
.
isNetworkConnected
())
{
if
(
this
.
isNetworkConnected
())
{
Log
.
d
(
TAG
,
"Scheduling location network post"
);
Log
.
d
(
TAG
,
"Scheduling location network post"
);
//
schedulePostLocations();
schedulePostLocations
();
}
else
{
}
else
{
Log
.
d
(
TAG
,
"Network unavailable, waiting for now"
);
Log
.
d
(
TAG
,
"Network unavailable, waiting for now"
);
}
}
...
...
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