// Path: app/src/main/java/net/fabiszewski/ulogger/LoggerTask.java
// static final int E_DISABLED = 2;
// 
// Path: app/src/main/java/net/fabiszewski/ulogger/LoggerTask.java
// static final int E_PERMISSION = 1;
// 
// Path: app/src/main/java/net/fabiszewski/ulogger/MainActivity.java
// public final static String UPDATED_PREFS = "extra_updated_prefs";


import static net.fabiszewski.ulogger.LoggerTask.E_DISABLED;
import static net.fabiszewski.ulogger.LoggerTask.E_PERMISSION;
import static net.fabiszewski.ulogger.MainActivity.UPDATED_PREFS;
import android.app.Notification;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
        looper = thread.getLooper();


        // keep database open during whole service runtime
        db = DbAccess.getInstance();
        db.open(this);
    }

    /**
     * Request location updates, start web synchronization if needed
     * @return True on success, false otherwise
     */
    private boolean initializeLocationUpdates() {
        if (Logger.DEBUG) { Log.d(TAG, "[initializeLocationUpdates]"); }
        try {
            locationHelper.updatePreferences();
            locationHelper.requestLocationUpdates(locationListener, looper);
            setRunning(true);
            sendBroadcast(BROADCAST_LOCATION_STARTED);

            syncIntent = new Intent(getApplicationContext(), WebSyncService.class);

            if (locationHelper.isLiveSync() && DbAccess.needsSync(this)) {
                getApplicationContext().startService(syncIntent);
            }
            return true;
        } catch (LocationHelper.LoggerException e) {
            int errorCode = e.getCode();
            if (errorCode == E_DISABLED) {
                sendBroadcast(BROADCAST_LOCATION_DISABLED);
// Path: app/src/main/java/net/fabiszewski/ulogger/LoggerTask.java
// static final int E_DISABLED = 2;
// 
// Path: app/src/main/java/net/fabiszewski/ulogger/LoggerTask.java
// static final int E_PERMISSION = 1;
// 
// Path: app/src/main/java/net/fabiszewski/ulogger/MainActivity.java
// public final static String UPDATED_PREFS = "extra_updated_prefs";


// Path: app/src/main/java/net/fabiszewski/ulogger/LoggerService.java
import static net.fabiszewski.ulogger.LoggerTask.E_DISABLED;
import static net.fabiszewski.ulogger.LoggerTask.E_PERMISSION;
import static net.fabiszewski.ulogger.MainActivity.UPDATED_PREFS;
import android.app.Notification;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;

        looper = thread.getLooper();


        // keep database open during whole service runtime
        db = DbAccess.getInstance();
        db.open(this);
    }

    /**
     * Request location updates, start web synchronization if needed
     * @return True on success, false otherwise
     */
    private boolean initializeLocationUpdates() {
        if (Logger.DEBUG) { Log.d(TAG, "[initializeLocationUpdates]"); }
        try {
            locationHelper.updatePreferences();
            locationHelper.requestLocationUpdates(locationListener, looper);
            setRunning(true);
            sendBroadcast(BROADCAST_LOCATION_STARTED);

            syncIntent = new Intent(getApplicationContext(), WebSyncService.class);

            if (locationHelper.isLiveSync() && DbAccess.needsSync(this)) {
                getApplicationContext().startService(syncIntent);
            }
            return true;
        } catch (LocationHelper.LoggerException e) {
            int errorCode = e.getCode();
            if (errorCode == E_DISABLED) {
                sendBroadcast(BROADCAST_LOCATION_DISABLED);
            } else if (errorCode == E_PERMISSION) {