Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
石璀亮
/
agenew_a16_sos
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit aa4d5f7c
authored
Apr 18, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
15次 取最佳精度
1 parent
7f8c53bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
app/src/main/java/com/agenew/location_server/application/BirdService.java
app/src/main/java/com/agenew/location_server/application/BirdService.java
View file @
aa4d5f7
...
@@ -114,6 +114,7 @@ public class BirdService extends Service {
...
@@ -114,6 +114,7 @@ public class BirdService extends Service {
};
};
private
int
mLocationCount
=
0
;
private
int
mLocationCount
=
0
;
private
float
mAccuracy
=
10000
;
public
AMapLocationListener
mLocationListener
=
new
AMapLocationListener
()
{
public
AMapLocationListener
mLocationListener
=
new
AMapLocationListener
()
{
@Override
@Override
...
@@ -127,12 +128,19 @@ public class BirdService extends Service {
...
@@ -127,12 +128,19 @@ public class BirdService extends Service {
+
", amapLocation.getAccuracy():"
+
amapLocation
.
getAccuracy
()
+
", amapLocation.getAccuracy():"
+
amapLocation
.
getAccuracy
()
+
"amapLocation.getLocationType()"
+
amapLocation
.
getLocationType
());
+
"amapLocation.getLocationType()"
+
amapLocation
.
getLocationType
());
if
(
mLocationCount
>
4
){
if
(
amapLocation
.
getAccuracy
()
<
mAccuracy
){
SimpleDateFormat
dateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
mAccuracy
=
amapLocation
.
getAccuracy
();
mStartTime
=
dateformat
.
format
(
System
.
currentTimeMillis
());
mLatitude
=
String
.
valueOf
(
amapLocation
.
getLatitude
());
mLatitude
=
String
.
valueOf
(
amapLocation
.
getLatitude
());
mLongitude
=
String
.
valueOf
(
amapLocation
.
getLongitude
());
mLongitude
=
String
.
valueOf
(
amapLocation
.
getLongitude
());
}
if
(
mLocationCount
>
15
){
Log
.
d
(
TAG
,
"LAST PERFECT INFO amapLocation.getLatitude(): "
+
mLatitude
+
", amapLocation.getLongitude(): "
+
mLongitude
+
", amapLocation.getAccuracy():"
+
mAccuracy
);
SimpleDateFormat
dateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
mStartTime
=
dateformat
.
format
(
System
.
currentTimeMillis
());
if
(
mLocationClient
!=
null
)
{
if
(
mLocationClient
!=
null
)
{
mLocationClient
.
stopLocation
();
mLocationClient
.
stopLocation
();
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment