更新 HeartbeatWorker.java
parent
4009796ac2
commit
935bd0edc3
|
|
@ -23,6 +23,7 @@ import timber.log.Timber;
|
|||
public class HeartbeatWorker extends Worker {
|
||||
private final Context context;
|
||||
private String accessToken;
|
||||
private String SN;
|
||||
|
||||
|
||||
public HeartbeatWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
|
||||
|
|
@ -66,11 +67,13 @@ public class HeartbeatWorker extends Worker {
|
|||
}
|
||||
|
||||
private <T>Request buildRequest(String apiUrl){
|
||||
SN = context.getResources().getString(R.string.SN);
|
||||
accessToken = context.getResources().getString(R.string.access_token);
|
||||
DeviceInfo deviceInfo = new DeviceInfo();
|
||||
deviceInfo.setDeviceBrand(DeviceInfoUtils.getDeviceBrand());
|
||||
deviceInfo.setDeviceModel(DeviceInfoUtils.getDeviceModel());
|
||||
deviceInfo.setAndroidVersion(DeviceInfoUtils.getDeviceAndroidVersion());
|
||||
deviceInfo.setAndroidVersion("Android " + DeviceInfoUtils.getDeviceAndroidVersion());
|
||||
deviceInfo.setSN(SN);
|
||||
Gson gson = new Gson();
|
||||
// 将对象转换为JSON字符串
|
||||
String json = gson.toJson(deviceInfo);
|
||||
|
|
|
|||
Loading…
Reference in New Issue