Compare commits
	
		
			2 Commits
		
	
	
		
			377ec4de09
			...
			dd20060754
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | dd20060754 | ||
|   | 298b337392 | 
| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Tue Oct 28 13:36:57 HKT 2025 | ||||
| #Tue Oct 28 06:06:00 GMT 2025 | ||||
| stageCount=16 | ||||
| libraryProject= | ||||
| baseVersion=15.0 | ||||
| publishVersion=15.0.15 | ||||
| buildCount=0 | ||||
| buildCount=6 | ||||
| baseBetaVersion=15.0.16 | ||||
|   | ||||
| @@ -630,9 +630,12 @@ public class MainService extends Service { | ||||
|      */ | ||||
|     @Override | ||||
|     public int onStartCommand(Intent intent, int flags, int startId) { | ||||
| 		boolean isSettingToEnable = intent.getBooleanExtra(EXTRA_IS_SETTING_TO_ENABLE, false); | ||||
| 		if (isSettingToEnable) { | ||||
| 			run(); // 重启服务核心逻辑(保证服务启动后进入运行状态) | ||||
| 		boolean isSettingToEnable = false; | ||||
| 		if (intent != null) { | ||||
| 			isSettingToEnable = intent.getBooleanExtra(EXTRA_IS_SETTING_TO_ENABLE, false); | ||||
| 			if (isSettingToEnable) { | ||||
| 				run(); // 重启服务核心逻辑(保证服务启动后进入运行状态) | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
|         // 如果被设置为自启动就返回START_STICKY:服务被异常杀死后,系统会尝试重启(原逻辑保留) | ||||
| @@ -904,7 +907,7 @@ public class MainService extends Service { | ||||
|         } | ||||
|         LogUtils.i(TAG, "任务触发通知:" + triggerContent); | ||||
|     } | ||||
| 	 | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 更新前台通知的GPS状态(Java 7 主线程切换,匿名Runnable实现) | ||||
|   | ||||
| @@ -111,17 +111,15 @@ public class DistanceCalculatorUtil { | ||||
| 			LogUtils.d(TAG, "传入坐标参数为空,退出函数。"); | ||||
| 			return; | ||||
| 		} | ||||
| 		if (mGpsPositionCalculated == null) { | ||||
| 			mGpsPositionCalculated = currentGpsPosition; | ||||
| 			LogUtils.d(TAG, "最后计算位置记录为空,现在使用新坐标为初始化。"); | ||||
| 		} | ||||
|  | ||||
| 		// 计算频率控制模块 | ||||
| 		// | ||||
| 		// 计算与最近一次GPS计算的时间间隔 | ||||
| 		long nCalculatedTimeBettween = System.currentTimeMillis() - mLastCalculatedTime; | ||||
| 		// 计算跳跃距离 | ||||
| 		double jumpDistance = calculateHaversineDistance(mGpsPositionCalculated.getLatitude(), mGpsPositionCalculated.getLongitude(), currentGpsPosition.getLatitude(), currentGpsPosition.getLongitude()); | ||||
| 		double gpsPositionCalculatedLatitude = mGpsPositionCalculated == null ?0.0f: mGpsPositionCalculated.getLatitude(); | ||||
| 		double gpsPositionCalculatedLongitude = mGpsPositionCalculated == null ?0.0f: mGpsPositionCalculated.getLongitude(); | ||||
| 		double jumpDistance = calculateHaversineDistance(gpsPositionCalculatedLatitude, gpsPositionCalculatedLongitude, currentGpsPosition.getLatitude(), currentGpsPosition.getLongitude()); | ||||
| 		if (jumpDistance < mMinjumpDistance) { | ||||
| 			LogUtils.d(TAG, String.format("checkAllTaskTriggerCondition:跳跃距离%f,小于50米。", jumpDistance)); | ||||
| 			// 跳跃距离小于最小有效跳跃值 | ||||
| @@ -132,22 +130,33 @@ public class DistanceCalculatorUtil { | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		LogUtils.d(TAG, String.format("checkAllTaskTriggerCondition:跳跃距离%f,与上次计算间隔%d,启动任务数据计算。", jumpDistance, nCalculatedTimeBettween)); | ||||
| 		if (mGpsPositionCalculated == null) { | ||||
| 			mGpsPositionCalculated = currentGpsPosition; | ||||
| 			LogUtils.d(TAG, "最后计算位置记录为空,现在使用新坐标为初始化。"); | ||||
| 		} | ||||
|  | ||||
| 		LogUtils.d(TAG, String.format("checkAllTaskTriggerCondition:跳跃距离%f,与上次计算间隔%d,现在启动任务数据计算。", jumpDistance, nCalculatedTimeBettween)); | ||||
|  | ||||
| 		// 获取位置任务基础数据 | ||||
| 		MainService mainService = MainService.getInstance(mContext); | ||||
| 		mPositionList = mainService.getPositionList(); | ||||
| 		mAllTasks = mainService.getAllTasks(); | ||||
|  | ||||
| 		// 任务为空,跳过校验。 | ||||
|         if (mPositionList.isEmpty() || mAllTasks.isEmpty()) { | ||||
|             LogUtils.d(TAG, "checkAllTaskTriggerCondition:任务数据为空,跳过校验。"); | ||||
| 		// 位置数据为空,跳过校验。 | ||||
|         if (mPositionList.isEmpty()) { | ||||
|             LogUtils.d(TAG, "checkAllTaskTriggerCondition:位置数据为空,跳过距离计算。"); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
| 		// 更新所有位置点的位置距离数据 | ||||
| 		refreshRealPositionDistance(currentGpsPosition); | ||||
|  | ||||
| 		// 任务数据为空,跳过校验。 | ||||
|         if (mAllTasks.isEmpty()) { | ||||
|             LogUtils.d(TAG, "checkAllTaskTriggerCondition:任务数据为空,跳过任务提醒检查计算。"); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         // 迭代器遍历任务(Java 7 安全遍历,避免并发修改异常) | ||||
|         Iterator<PositionTaskModel> taskIter = mAllTasks.iterator(); | ||||
|         while (taskIter.hasNext()) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user