更新 HeartbeatWorker.java
parent
f288d8c6f2
commit
1220777e5a
|
|
@ -42,6 +42,7 @@ public class HeartbeatWorker extends Worker {
|
|||
}
|
||||
|
||||
private void sendHeartbeatSignal() {
|
||||
Timber.d("开始执行发送心跳");
|
||||
String heartBeatURL = context.getResources().getString(R.string.heart_beat_url); // 获取URL
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = buildRequest(heartBeatURL);
|
||||
|
|
@ -92,7 +93,7 @@ public class HeartbeatWorker extends Worker {
|
|||
Gson gson = new Gson();
|
||||
// 将对象转换为JSON字符串
|
||||
String json = gson.toJson(deviceInfo);
|
||||
Timber.d("Building request to " + apiUrl + " with data: " + json);
|
||||
// Timber.d("Building request to " + apiUrl + " with data: " + json);
|
||||
// 创建请求体
|
||||
MediaType JSON = MediaType.get("application/json; charset=utf-8");
|
||||
RequestBody body = RequestBody.create(json, JSON);
|
||||
|
|
|
|||
Loading…
Reference in New Issue