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 29a62ad3
authored
Apr 16, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一直通知版本
1 parent
f8ba8e21
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 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 @
29a62ad
...
...
@@ -86,7 +86,7 @@ public class BirdService extends Service {
intent2
.
addFlags
(
0x01000000
);
sendBroadcast
(
intent2
);
if
(
DevicePreferences
.
getInstance
(
this
).
getBoolean
(
"is_need_notification"
,
true
)){
//
if (DevicePreferences.getInstance(this).getBoolean("is_need_notification", true)){
String
CHANNEL_ONE_ID
=
"com.primedu.cn"
;
String
CHANNEL_ONE_NAME
=
"Channel One"
;
...
...
@@ -113,9 +113,9 @@ public class BirdService extends Service {
startForeground
(
1
,
notification
);
}
else
{
DevicePreferences
.
getInstance
(
this
).
putBoolean
(
"is_need_notification"
,
true
);
}
//
}else{
//
DevicePreferences.getInstance(this).putBoolean("is_need_notification", true);
//
}
ret_cfgv
=
DevicePreferences
.
getInstance
(
getApplicationContext
()).
getString
(
"bird_ret_cfgv"
,
"2019031512"
);
mPath
=
DevicePreferences
.
getInstance
(
mContext
).
getString
(
"bird_location_upload_url"
,
DEFAULTPATH
);
...
...
@@ -138,7 +138,12 @@ public class BirdService extends Service {
if
(
amapLocation
!=
null
)
{
if
(
amapLocation
.
getErrorCode
()
==
0
)
{
mLocationCount
++;
if
(
mLocationCount
>
10
){
Log
.
d
(
TAG
,
"amapLocation.getLatitude(): "
+
amapLocation
.
getLatitude
()
+
", amapLocation.getLongitude(): "
+
amapLocation
.
getLongitude
()
+
", amapLocation.getAccuracy():"
+
amapLocation
.
getAccuracy
()
+
"amapLocation.getLocationType()"
+
amapLocation
.
getLocationType
());
if
(
mLocationCount
>
5
){
SimpleDateFormat
dateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
mStartTime
=
dateformat
.
format
(
System
.
currentTimeMillis
());
...
...
@@ -153,14 +158,10 @@ public class BirdService extends Service {
}
}
else
{
// setAlarm();
Log
.
e
(
TAG
,
"location Error, ErrCode:"
+
amapLocation
.
getErrorCode
()
+
", errInfo:"
+
amapLocation
.
getErrorInfo
());
/* if (mLocationClient != null) {
mLocationClient.stopLocation();
}*/
}
}
else
{
Log
.
d
(
TAG
,
"location Error"
);
...
...
@@ -325,6 +326,7 @@ public class BirdService extends Service {
//set model is AMapLocationMode.Battery_Saving
mLocationOption
.
setLocationMode
(
AMapLocationClientOption
.
AMapLocationMode
.
Hight_Accuracy
);
mLocationOption
.
setInterval
(
1000
);
mLocationOption
.
setLocationCacheEnable
(
false
);
mLocationClient
.
setLocationOption
(
mLocationOption
);
mLocationClient
.
startLocation
();
...
...
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