添加任务触发通知发送功能。

This commit is contained in:
ZhanGSKen
2025-10-03 11:24:44 +08:00
parent 721a0af8c0
commit f0f248b018
2 changed files with 5 additions and 3 deletions

View File

@@ -686,7 +686,7 @@ public class MainService extends Service {
* @param bindPos 任务绑定的位置
* @param currentDistance 当前距离
*/
private void sendTaskTriggerNotification(PositionTaskModel task, PositionModel bindPos, double currentDistance) {
private void sendTaskTriggerNotification(final PositionTaskModel task, PositionModel bindPos, double currentDistance) {
if (!_mIsServiceRunning) {
return;
}
@@ -707,11 +707,13 @@ public class MainService extends Service {
// 显示Toast主线程安全调用Java 7 匿名内部类)
if (Looper.myLooper() == Looper.getMainLooper()) {
ToastUtils.show(triggerContent);
NotificationUtil.show(MainService.this, task.getTaskId(), task.getPositionId(), task.getTaskDescription());
} else {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
ToastUtils.show(triggerContent);
NotificationUtil.show(MainService.this, task.getTaskId(), task.getPositionId(), task.getTaskDescription());
}
});
}