服务模块启动参数BugFix.
This commit is contained in:
@@ -630,9 +630,12 @@ public class MainService extends Service {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
boolean isSettingToEnable = intent.getBooleanExtra(EXTRA_IS_SETTING_TO_ENABLE, false);
|
boolean isSettingToEnable = false;
|
||||||
if (isSettingToEnable) {
|
if (intent != null) {
|
||||||
run(); // 重启服务核心逻辑(保证服务启动后进入运行状态)
|
isSettingToEnable = intent.getBooleanExtra(EXTRA_IS_SETTING_TO_ENABLE, false);
|
||||||
|
if (isSettingToEnable) {
|
||||||
|
run(); // 重启服务核心逻辑(保证服务启动后进入运行状态)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果被设置为自启动就返回START_STICKY:服务被异常杀死后,系统会尝试重启(原逻辑保留)
|
// 如果被设置为自启动就返回START_STICKY:服务被异常杀死后,系统会尝试重启(原逻辑保留)
|
||||||
|
|||||||
Reference in New Issue
Block a user