导航菜单

页面标题

页面副标题

fieldd v4.2.4 - BootCompletedReceiver.java 源代码

正在查看: fieldd v4.2.4 应用的 BootCompletedReceiver.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.marianhello.bgloc;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.marianhello.bgloc.data.DAOFactory;
import com.marianhello.bgloc.service.LocationServiceImpl;
import org.json.JSONException;

public class BootCompletedReceiver extends BroadcastReceiver {
    private static final String TAG = "com.marianhello.bgloc.BootCompletedReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        Config config;
        Log.d(TAG, "Received boot completed");
        try {
            config = DAOFactory.createConfigurationDAO(context).retrieveConfiguration();
        } catch (JSONException unused) {
            config = null;
        }
        if (config == null) {
            return;
        }
        String str = TAG;
        Log.d(str, "Boot completed " + config.toString());
        if (config.getStartOnBoot().booleanValue()) {
            Log.i(str, "Starting service after boot");
            Intent intent2 = new Intent(context, (Class<?>) LocationServiceImpl.class);
            intent2.addFlags(4);
            intent2.putExtra(Config.BUNDLE_KEY, config);
            context.startForegroundService(intent2);
        }
    }
}