服务模块启动参数BugFix.
This commit is contained in:
@@ -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实现)
|
||||
|
||||
Reference in New Issue
Block a user