添加任务触发通知发送功能。
This commit is contained in:
@@ -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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user