Compare commits
3 Commits
e16a598617
...
1938470b43
| Author | SHA1 | Date | |
|---|---|---|---|
| 1938470b43 | |||
| 1220777e5a | |||
| f288d8c6f2 |
@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class EchoLink extends Application {
|
public class EchoLink extends Application {
|
||||||
private static final int EXECUTION_INTERVAL = 15; // 示例:15分钟
|
private static final int EXECUTION_INTERVAL = 10; // 示例:15分钟
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class HeartbeatWorker extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendHeartbeatSignal() {
|
private void sendHeartbeatSignal() {
|
||||||
|
Timber.d("开始执行发送心跳");
|
||||||
String heartBeatURL = context.getResources().getString(R.string.heart_beat_url); // 获取URL
|
String heartBeatURL = context.getResources().getString(R.string.heart_beat_url); // 获取URL
|
||||||
OkHttpClient client = new OkHttpClient();
|
OkHttpClient client = new OkHttpClient();
|
||||||
Request request = buildRequest(heartBeatURL);
|
Request request = buildRequest(heartBeatURL);
|
||||||
@@ -92,7 +93,7 @@ public class HeartbeatWorker extends Worker {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
// 将对象转换为JSON字符串
|
// 将对象转换为JSON字符串
|
||||||
String json = gson.toJson(deviceInfo);
|
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");
|
MediaType JSON = MediaType.get("application/json; charset=utf-8");
|
||||||
RequestBody body = RequestBody.create(json, JSON);
|
RequestBody body = RequestBody.create(json, JSON);
|
||||||
|
|||||||
@@ -64,12 +64,6 @@ public class PermissionUtils {
|
|||||||
// 显示对话框
|
// 显示对话框
|
||||||
Timber.d("权限被拒绝:" + deniedPermissions.toString());
|
Timber.d("权限被拒绝:" + deniedPermissions.toString());
|
||||||
showAlert("以下权限被拒绝:\n" + deniedPermissions.toString());
|
showAlert("以下权限被拒绝:\n" + deniedPermissions.toString());
|
||||||
} else {
|
|
||||||
// 所有请求的权限都被授予
|
|
||||||
// 在这里处理所有权限被授予的情况
|
|
||||||
Timber.d("已获取所有权限:" + Arrays.toString(permissions));
|
|
||||||
showToast("已授予运行所需的权限");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user