导航菜单

页面标题

页面副标题

Biko v2.0.23 - LocationBroadcastReceiver.java 源代码

正在查看: Biko v2.0.23 应用的 LocationBroadcastReceiver.java JAVA 源代码文件

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


package com.birjuvachhani.locus;

import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
import android.util.Log;
import androidx.lifecycle.MutableLiveData;
import com.birjuvachhani.locus.LocusResult;
import com.google.android.gms.location.LocationResult;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;

@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u0000 \t2\u00020\u0001:\u0001\tB\u0005¢\u0006\u0002\u0010\u0002J\u001c\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0016¨\u0006\n"}, d2 = {"Lcom/birjuvachhani/locus/LocationBroadcastReceiver;", "Landroid/content/BroadcastReceiver;", "()V", "onReceive", "", "context", "Landroid/content/Context;", "intent", "Landroid/content/Intent;", "Companion", "locus_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class LocationBroadcastReceiver extends BroadcastReceiver {
    public static final String ACTION_PROCESS_UPDATES = "com.birjuvachhani.locus.LocationProvider.LocationBroadcastReceiver.action.PROCESS_UPDATES";

    public static final Companion INSTANCE = new Companion(null);

    @Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bR\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006\t"}, d2 = {"Lcom/birjuvachhani/locus/LocationBroadcastReceiver$Companion;", "", "()V", "ACTION_PROCESS_UPDATES", "", "getPendingIntent", "Landroid/app/PendingIntent;", "context", "Landroid/content/Context;", "locus_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final PendingIntent getPendingIntent(Context context) {
            Intrinsics.checkNotNullParameter(context, "context");
            Intent intent = new Intent(context, (Class<?>) LocationBroadcastReceiver.class);
            intent.setAction(LocationBroadcastReceiver.ACTION_PROCESS_UPDATES);
            PendingIntent broadcast = PendingIntent.getBroadcast(context, 0, intent, Build.VERSION.SDK_INT >= 31 ? 167772160 : 134217728);
            Intrinsics.checkNotNullExpressionValue(broadcast, "getBroadcast(context, 0, intent, flags)");
            return broadcast;
        }
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if (LoggerKt.isLoggingEnabled()) {
            Log.d(getClass().getSimpleName(), "Received location update broadcast");
        }
        if (intent != null && Intrinsics.areEqual(intent.getAction(), ACTION_PROCESS_UPDATES) && LocationResult.hasResult(intent)) {
            LocationResult extractResult = LocationResult.extractResult(intent);
            Intrinsics.checkNotNullExpressionValue(extractResult.getLocations(), "result.locations");
            if (!r4.isEmpty()) {
                String str = "Received location " + extractResult.getLastLocation();
                if (LoggerKt.isLoggingEnabled()) {
                    Log.d(getClass().getSimpleName(), str);
                }
                MutableLiveData<LocusResult> locationLiveData = LocusKt.getLocationLiveData();
                LocusResult.Companion companion = LocusResult.INSTANCE;
                Location lastLocation = extractResult.getLastLocation();
                Intrinsics.checkNotNullExpressionValue(lastLocation, "result.lastLocation");
                locationLiveData.postValue(companion.success$locus_release(lastLocation));
            }
        }
    }
}