更新 HeartbeatWorker.java

dev
wangsiyuan 2023-12-09 15:54:33 +08:00
parent f288d8c6f2
commit 1220777e5a
1 changed files with 2 additions and 1 deletions

View File

@ -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);