导航菜单

页面标题

页面副标题

Meine NEW v2.0.3616 - StartupBroadcastReceiver.java 源代码

正在查看: Meine NEW v2.0.3616 应用的 StartupBroadcastReceiver.java JAVA 源代码文件

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


package org.altbeacon.beacon.startup;

import android.bluetooth.le.ScanResult;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.media.a;
import java.util.ArrayList;
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.logging.LogManager;
import org.altbeacon.beacon.service.ScanJobScheduler;

public class StartupBroadcastReceiver extends BroadcastReceiver {
    private static final String TAG = "StartupBroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        LogManager.d(TAG, "onReceive called in startup broadcast receiver", new Object[0]);
        int i = Build.VERSION.SDK_INT;
        BeaconManager instanceForApplication = BeaconManager.getInstanceForApplication(context.getApplicationContext());
        if (!instanceForApplication.isAnyConsumerBound() && !instanceForApplication.getScheduledScanJobsEnabled() && instanceForApplication.getIntentScanStrategyCoordinator() == null) {
            LogManager.d(TAG, "No consumers are bound.  Ignoring broadcast receiver.", new Object[0]);
            return;
        }
        int intExtra = intent.getIntExtra("android.bluetooth.le.extra.CALLBACK_TYPE", -1);
        if (intExtra == -1) {
            if (intent.getBooleanExtra("wakeup", false)) {
                LogManager.d(TAG, "got wake up intent", new Object[0]);
                return;
            } else {
                LogManager.d(TAG, "Already started.  Ignoring intent: %s of type: %s", intent, intent.getStringExtra("wakeup"));
                return;
            }
        }
        LogManager.d(TAG, a.e("Passive background scan callback type: ", intExtra), new Object[0]);
        LogManager.d(TAG, "got Android O background scan via intent", new Object[0]);
        int intExtra2 = intent.getIntExtra("android.bluetooth.le.extra.ERROR_CODE", -1);
        if (intExtra2 != -1) {
            LogManager.w(TAG, a.e("Passive background scan failed.  Code; ", intExtra2), new Object[0]);
        }
        ArrayList<ScanResult> parcelableArrayListExtra = intent.getParcelableArrayListExtra("android.bluetooth.le.extra.LIST_SCAN_RESULT");
        if (instanceForApplication.getIntentScanStrategyCoordinator() != null && i >= 26) {
            instanceForApplication.getIntentScanStrategyCoordinator().processScanResults(parcelableArrayListExtra);
        } else if (instanceForApplication.getScheduledScanJobsEnabled()) {
            ScanJobScheduler.getInstance().scheduleAfterBackgroundWakeup(context, parcelableArrayListExtra);
        }
    }
}