Compare commits
3 Commits
ac624c70b2
...
79a246cbd6
| Author | SHA1 | Date | |
|---|---|---|---|
| 79a246cbd6 | |||
| 935bd0edc3 | |||
| 4009796ac2 |
@@ -4,14 +4,16 @@ public class DeviceInfo {
|
|||||||
private String deviceBrand;
|
private String deviceBrand;
|
||||||
private String deviceModel;
|
private String deviceModel;
|
||||||
private String androidVersion;
|
private String androidVersion;
|
||||||
|
private String SN;
|
||||||
|
|
||||||
public DeviceInfo() {
|
public DeviceInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceInfo(String deviceBrand, String deviceModel, String androidVersion) {
|
public DeviceInfo(String deviceBrand, String deviceModel, String androidVersion,String SN) {
|
||||||
this.deviceBrand = deviceBrand;
|
this.deviceBrand = deviceBrand;
|
||||||
this.deviceModel = deviceModel;
|
this.deviceModel = deviceModel;
|
||||||
this.androidVersion = androidVersion;
|
this.androidVersion = androidVersion;
|
||||||
|
this.SN = SN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeviceBrand() {
|
public String getDeviceBrand() {
|
||||||
@@ -38,12 +40,21 @@ public class DeviceInfo {
|
|||||||
this.androidVersion = androidVersion;
|
this.androidVersion = androidVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSN() {
|
||||||
|
return SN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSN(String SN) {
|
||||||
|
this.SN = SN;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DeviceInfo{" +
|
return "DeviceInfo{" +
|
||||||
"deviceBrand='" + deviceBrand + '\'' +
|
"deviceBrand='" + deviceBrand + '\'' +
|
||||||
", deviceModel='" + deviceModel + '\'' +
|
", deviceModel='" + deviceModel + '\'' +
|
||||||
", androidVersion='" + androidVersion + '\'' +
|
", androidVersion='" + androidVersion + '\'' +
|
||||||
|
", SN='" + SN + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import timber.log.Timber;
|
|||||||
public class HeartbeatWorker extends Worker {
|
public class HeartbeatWorker extends Worker {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private String accessToken;
|
private String accessToken;
|
||||||
|
private String SN;
|
||||||
|
|
||||||
|
|
||||||
public HeartbeatWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
|
public HeartbeatWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
|
||||||
@@ -66,11 +67,13 @@ public class HeartbeatWorker extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T>Request buildRequest(String apiUrl){
|
private <T>Request buildRequest(String apiUrl){
|
||||||
|
SN = context.getResources().getString(R.string.SN);
|
||||||
accessToken = context.getResources().getString(R.string.access_token);
|
accessToken = context.getResources().getString(R.string.access_token);
|
||||||
DeviceInfo deviceInfo = new DeviceInfo();
|
DeviceInfo deviceInfo = new DeviceInfo();
|
||||||
deviceInfo.setDeviceBrand(DeviceInfoUtils.getDeviceBrand());
|
deviceInfo.setDeviceBrand(DeviceInfoUtils.getDeviceBrand());
|
||||||
deviceInfo.setDeviceModel(DeviceInfoUtils.getDeviceModel());
|
deviceInfo.setDeviceModel(DeviceInfoUtils.getDeviceModel());
|
||||||
deviceInfo.setAndroidVersion(DeviceInfoUtils.getDeviceAndroidVersion());
|
deviceInfo.setAndroidVersion("Android " + DeviceInfoUtils.getDeviceAndroidVersion());
|
||||||
|
deviceInfo.setSN(SN);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
// 将对象转换为JSON字符串
|
// 将对象转换为JSON字符串
|
||||||
String json = gson.toJson(deviceInfo);
|
String json = gson.toJson(deviceInfo);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<string name="call_api_url">https://api.kimgo.cn/api/call</string>
|
<string name="call_api_url">https://api.kimgo.cn/api/call</string>
|
||||||
<string name="message_api_url">https://api.kimgo.cn/api/sms</string>
|
<string name="message_api_url">https://api.kimgo.cn/api/sms</string>
|
||||||
<string name="heart_beat_url">https://api.kimgo.cn/heartbeat</string>
|
<string name="heart_beat_url">https://api.kimgo.cn/heartbeat</string>
|
||||||
|
<string name="SN">XCCS3IK75OCM</string>
|
||||||
<string name="access_token">gKGCDSgWV82XbU0H</string>
|
<string name="access_token">gKGCDSgWV82XbU0H</string>
|
||||||
<string name="notification_title">监控服务运行中</string>
|
<string name="notification_title">监控服务运行中</string>
|
||||||
<string name="notification_text">EchoLink正在运行</string>
|
<string name="notification_text">EchoLink正在运行</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user