新增服务组件和工具类

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
wchino
2026-04-05 22:29:42 +08:00
parent e11841f19d
commit f0fe8de4e2
5 changed files with 600 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package com.miraclegarden.smsmessage.service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
/**
* 开机后重启监听服务。
*/
public class BootReceiver extends BroadcastReceiver {
private static final long BOOT_DELAY_MS = 5000;
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
new Handler(Looper.getMainLooper()).postDelayed(() -> {
NotificationService.requestStartMonitoring(context);
}, BOOT_DELAY_MS);
}
}
}