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 05da71ce
authored
Apr 19, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
360 属性更新 以及 更新 取优化点算法
1 parent
aa4d5f7c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
app/build.gradle
app/src/main/java/com/agenew/location_server/application/BirdService.java
app/src/main/java/com/agenew/location_server/application/PhoneUtils.java
app/build.gradle
View file @
05da71c
...
...
@@ -33,4 +33,7 @@ dependencies {
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
implementation
'com.amap.api:location:4.5.1'
implementation
'com.amap.api:map2d:5.2.0'
}
app/src/main/java/com/agenew/location_server/application/BirdService.java
View file @
05da71c
...
...
@@ -32,6 +32,8 @@ import com.amap.api.location.AMapLocation;
import
com.amap.api.location.AMapLocationClient
;
import
com.amap.api.location.AMapLocationClientOption
;
import
com.amap.api.location.AMapLocationListener
;
import
com.amap.api.maps2d.AMapUtils
;
import
com.amap.api.maps2d.model.LatLng
;
import
org.json.JSONObject
;
...
...
@@ -69,6 +71,10 @@ public class BirdService extends Service {
private
String
ret_cfgv
=
"2019031512"
;
private
LocationManager
mLocationManager
;
private
int
mNewMsgCount
=
0
;
private
double
mWifiLatitude
=
0
;
private
double
mWifiLongitude
=
0
;
private
double
mGpsLatitude
=
0
;
private
double
mGpsLongitude
=
0
;
@Override
public
IBinder
onBind
(
Intent
intent
)
{
...
...
@@ -115,6 +121,9 @@ public class BirdService extends Service {
private
int
mLocationCount
=
0
;
private
float
mAccuracy
=
10000
;
private
float
mWifiAccuracy
=
1000
;
private
float
mGpsAccuracy
=
1000
;
public
AMapLocationListener
mLocationListener
=
new
AMapLocationListener
()
{
@Override
...
...
@@ -123,6 +132,7 @@ public class BirdService extends Service {
if
(
amapLocation
!=
null
)
{
if
(
amapLocation
.
getErrorCode
()
==
0
)
{
mLocationCount
++;
Log
.
d
(
TAG
,
"amapLocation.getLatitude(): "
+
amapLocation
.
getLatitude
()
+
", amapLocation.getLongitude(): "
+
amapLocation
.
getLongitude
()
+
", amapLocation.getAccuracy():"
+
amapLocation
.
getAccuracy
()
...
...
@@ -130,11 +140,49 @@ public class BirdService extends Service {
if
(
amapLocation
.
getAccuracy
()
<
mAccuracy
){
mAccuracy
=
amapLocation
.
getAccuracy
();
mLatitude
=
String
.
valueOf
(
amapLocation
.
getLatitude
());
mLatitude
=
String
.
valueOf
(
amapLocation
.
getLatitude
());
mLongitude
=
String
.
valueOf
(
amapLocation
.
getLongitude
());
}
if
(
amapLocation
.
getLocationType
()
==
5
){
if
(
amapLocation
.
getAccuracy
()
<
mWifiAccuracy
){
mWifiAccuracy
=
amapLocation
.
getAccuracy
();
mWifiLatitude
=
amapLocation
.
getLatitude
();
mWifiLongitude
=
amapLocation
.
getLongitude
();
}
}
if
(
amapLocation
.
getLocationType
()
==
1
){
if
(
amapLocation
.
getAccuracy
()
<
mGpsAccuracy
){
mGpsAccuracy
=
amapLocation
.
getAccuracy
();
mGpsLatitude
=
amapLocation
.
getLatitude
();
mGpsLongitude
=
amapLocation
.
getLongitude
();
}
}
if
(
mLocationCount
>
15
){
if
(
mWifiLatitude
!=
0
&&
mWifiLongitude
!=
0
&&
mGpsLatitude
!=
0
&&
mGpsLongitude
!=
0
){
LatLng
wifiLatLng
=
new
LatLng
(
mWifiLatitude
,
mWifiLongitude
);
LatLng
gpsLatLng
=
new
LatLng
(
mGpsLatitude
,
mGpsLongitude
);
float
distance
=
AMapUtils
.
calculateLineDistance
(
wifiLatLng
,
gpsLatLng
);
Log
.
d
(
TAG
,
"distance: "
+
distance
+
", mWifiAccuracy:"
+
mWifiAccuracy
+
", mGpsAccuracy: "
+
mGpsAccuracy
);
if
(
distance
>
mWifiAccuracy
+
60
){
mLatitude
=
String
.
valueOf
(
mWifiLatitude
);
mLongitude
=
String
.
valueOf
(
mWifiLongitude
);
mAccuracy
=
mWifiAccuracy
;
}
else
{
mLatitude
=
String
.
valueOf
(
mGpsLatitude
);
mLongitude
=
String
.
valueOf
(
mGpsLongitude
);
mAccuracy
=
mGpsAccuracy
;
}
}
Log
.
d
(
TAG
,
"LAST PERFECT INFO amapLocation.getLatitude(): "
+
mLatitude
+
", amapLocation.getLongitude(): "
+
mLongitude
+
", amapLocation.getAccuracy():"
+
mAccuracy
);
...
...
@@ -338,7 +386,8 @@ public class BirdService extends Service {
mIMSIStr
=
temp_imsi
.
substring
(
0
,
temp_imsi
.
length
()
-
1
);
mICCIDStr
=
temp_iccid
.
substring
(
0
,
temp_iccid
.
length
()
-
1
);
String
temp_model
=
Build
.
MODEL
;
// String temp_model = Build.MODEL;
String
temp_model
=
PhoneUtils
.
getProperty
(
"ro.qiku.custom.model"
,
"undefined"
);
mModel
=
temp_model
.
trim
().
replaceAll
(
" "
,
""
);
}
...
...
app/src/main/java/com/agenew/location_server/application/PhoneUtils.java
0 → 100644
View file @
05da71c
This diff is collapsed.
Click to expand it.
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