导航菜单

页面标题

页面副标题

xDrip+ v04633772025.07.16 - SyncService.java 源代码

正在查看: xDrip+ v04633772025.07.16 应用的 SyncService.java JAVA 源代码文件

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


package com.eveningoutpost.dexdrip.services;

import android.app.IntentService;
import android.app.PendingIntent;
import android.content.Intent;
import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.models.UserError;
import com.eveningoutpost.dexdrip.utilitymodels.Pref;
import com.eveningoutpost.dexdrip.utilitymodels.UploaderTask;
import com.eveningoutpost.dexdrip.xdrip;

public class SyncService extends IntentService {
    public SyncService() {
        super("SyncService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        UserError.Log.d("SyncService", "STARTING INTENT SERVICE");
        attemptSend();
    }

    private void attemptSend() {
        if (Pref.getBooleanDefaultFalse("cloud_storage_api_enable") || Pref.getBooleanDefaultFalse("wear_sync") || Pref.getBooleanDefaultFalse("cloud_storage_mongodb_enable") || Pref.getBooleanDefaultFalse("cloud_storage_influxdb_enable")) {
            synctoCloudDatabases();
            startSyncService(360000L);
        }
    }

    private void synctoCloudDatabases() {
        new UploaderTask().executeOnExecutor(xdrip.executor, new String[0]);
    }

    public static void startSyncService(long j) {
        UserError.Log.d("SyncService", "static starting Sync service delay: " + j);
        if (j == 0) {
            xdrip.getAppContext().startService(new Intent(xdrip.getAppContext(), (Class<?>) SyncService.class));
        } else {
            JoH.wakeUpIntent(xdrip.getAppContext(), j, PendingIntent.getService(xdrip.getAppContext(), 1004, new Intent(xdrip.getAppContext(), (Class<?>) SyncService.class), 268435456));
        }
    }
}