Commit 29a62ad3 by cuiliang.shi

一直通知版本

1 parent f8ba8e21
......@@ -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();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!