| xqd
@@ -105,10 +105,10 @@ import top.maybesix.xhlibrary.serialport.ComPortData;
|
|
|
import top.maybesix.xhlibrary.serialport.SerialPortHelper;
|
|
|
import top.maybesix.xhlibrary.util.HexStringUtils;
|
|
|
|
|
|
-import com.siwei.recyclebox.entity.MapLocationInfo;
|
|
|
+//import com.siwei.recyclebox.entity.MapLocationInfo;
|
|
|
import com.siwei.recyclebox.service.MyService;
|
|
|
import com.siwei.recyclebox.utils.DemoOne;
|
|
|
-import com.siwei.recyclebox.utils.LocationUtils;
|
|
|
+//import com.siwei.recyclebox.utils.LocationUtils;
|
|
|
import com.siwei.recyclebox.utils.SilentInstall;
|
|
|
import com.siwei.recyclebox.utils.unZipFileDemo;
|
|
|
import com.zhy.http.okhttp.OkHttpUtils;
|
| xqd
@@ -124,9 +124,9 @@ public class MainViewModel extends BaseViewModel implements SerialPortHelper.OnS
|
|
|
private TimerTask task1;
|
|
|
private TimerTask task2;
|
|
|
private TimerTask task3;
|
|
|
- private LocationUtils mLocationUtils;
|
|
|
+// private LocationUtils mLocationUtils;
|
|
|
/** 定位信息 */
|
|
|
- private MapLocationInfo mMapLocationInfo;
|
|
|
+// private MapLocationInfo mMapLocationInfo;
|
|
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
|
public void onCreate(){
|
|
|
super.onCreate();
|
| xqd
@@ -324,7 +324,7 @@ public class MainViewModel extends BaseViewModel implements SerialPortHelper.OnS
|
|
|
int hour=readTime();
|
|
|
Log.i("当前时间hour是:",hour+"dian");
|
|
|
// getDeviceProperty("1");
|
|
|
- Log.i(TAG,"纬度"+mMapLocationInfo.getLatitude()+"经度"+mMapLocationInfo.getLongitude());
|
|
|
+// Log.i(TAG,"纬度"+mMapLocationInfo.getLatitude()+"经度"+mMapLocationInfo.getLongitude());
|
|
|
}
|
|
|
};
|
|
|
public View.OnClickListener btnClickreadWeight = new View.OnClickListener() {
|
| xqd
@@ -1130,14 +1130,14 @@ public class MainViewModel extends BaseViewModel implements SerialPortHelper.OnS
|
|
|
Integer networkNum=netWorkInfo();
|
|
|
if(networkNum!=0) {
|
|
|
try {
|
|
|
- double longitude = 107.31;
|
|
|
- double latitude = 23.16;
|
|
|
- if (mMapLocationInfo != null) {
|
|
|
- longitude = mMapLocationInfo.getLongitude();
|
|
|
- latitude = mMapLocationInfo.getLatitude();
|
|
|
- Log.i(TAG, mMapLocationInfo.toString() + "--地址:" + mMapLocationInfo.getAddress());
|
|
|
-
|
|
|
- }
|
|
|
+ double longitude = 104.05;
|
|
|
+ double latitude = 30.69;
|
|
|
+// if (mMapLocationInfo != null) {
|
|
|
+// longitude = mMapLocationInfo.getLongitude();
|
|
|
+// latitude = mMapLocationInfo.getLatitude();
|
|
|
+// Log.i(TAG, mMapLocationInfo.toString() + "--地址:" + mMapLocationInfo.getAddress());
|
|
|
+//
|
|
|
+// }
|
|
|
Integer weight = 0;
|
|
|
Log.i("num=1", "读一次称重");
|
|
|
weight = SerialPortUtil.getInstance().getWeightDevice().readWeight();//读称重
|
| xqd
@@ -2114,6 +2114,10 @@ public class MainViewModel extends BaseViewModel implements SerialPortHelper.OnS
|
|
|
public void run() {
|
|
|
publish();
|
|
|
openLight();
|
|
|
+// Integer networkInt=netWorkInfo();
|
|
|
+// if(networkInt==0) {
|
|
|
+// restartApp();
|
|
|
+// }
|
|
|
}
|
|
|
};
|
|
|
timer.schedule(task1,600000,1800000);
|
| xqd
@@ -2171,7 +2175,8 @@ public class MainViewModel extends BaseViewModel implements SerialPortHelper.OnS
|
|
|
Log.i("day","关灯");
|
|
|
SerialPortUtil.getInstance().getOtherDevice().closeLight1();
|
|
|
if(readTime()==3){
|
|
|
- restartAndroid();
|
|
|
+ restartApp();
|
|
|
+// restartAndroid();
|
|
|
}
|
|
|
}
|
|
|
}
|
| xqd
@@ -2187,14 +2192,14 @@ public class MainViewModel extends BaseViewModel implements SerialPortHelper.OnS
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
|
- public void startJobScheduler() {
|
|
|
- int jobId = 1;
|
|
|
- @SuppressLint("JobSchedulerService") JobInfo.Builder jobInfo = new JobInfo.Builder(jobId, new ComponentName(getApplication(), MyService.class));
|
|
|
- jobInfo.setPeriodic(10000);
|
|
|
- jobInfo.setPersisted(true);
|
|
|
- JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
|
|
|
- jobScheduler.schedule(jobInfo.build());
|
|
|
- }
|
|
|
+// @TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
|
+// public void startJobScheduler() {
|
|
|
+// int jobId = 1;
|
|
|
+// @SuppressLint("JobSchedulerService") JobInfo.Builder jobInfo = new JobInfo.Builder(jobId, new ComponentName(getApplication(), MyService.class));
|
|
|
+// jobInfo.setPeriodic(10000);
|
|
|
+// jobInfo.setPersisted(true);
|
|
|
+// JobScheduler jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
|
|
|
+// jobScheduler.schedule(jobInfo.build());
|
|
|
+// }
|
|
|
|
|
|
}
|