Loading app/src/main/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -45,9 +45,11 @@ android:foregroundServiceType="location" /> <service android:name=".WebSyncService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" /> <service android:name=".GpxExportService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" /> <receiver Loading app/src/main/java/net/fabiszewski/ulogger/GpxExportService.java +14 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ package net.fabiszewski.ulogger; import android.app.IntentService; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; Loading @@ -17,6 +17,7 @@ import android.util.Log; import android.util.Xml; import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; import org.xmlpull.v1.XmlSerializer; Loading @@ -27,7 +28,7 @@ import java.io.OutputStream; /** * Export track to GPX format */ public class GpxExportService extends IntentService { public class GpxExportService extends JobIntentService { private static final String TAG = GpxExportService.class.getSimpleName(); Loading @@ -43,12 +44,17 @@ public class GpxExportService extends IntentService { public static final String GPX_EXTENSION = ".gpx"; public static final String GPX_MIME = "application/gpx+xml"; public GpxExportService() { super("GpxExportService"); } private DbAccess db; static final int JOB_ID = 1000; /** * Convenience method for enqueuing work in to this service. */ static void enqueueWork(Context context, Intent work) { enqueueWork(context, GpxExportService.class, JOB_ID, work); } @Override public void onCreate() { super.onCreate(); Loading @@ -75,8 +81,8 @@ public class GpxExportService extends IntentService { * @param intent Intent */ @Override protected void onHandleIntent(Intent intent) { if (intent != null && intent.getData() != null) { protected void onHandleWork(@NonNull Intent intent) { if (intent.getData() != null) { try { write(intent.getData()); sendBroadcast(BROADCAST_EXPORT_DONE, null); Loading app/src/main/java/net/fabiszewski/ulogger/LoggerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class LoggerService extends Service { // start websync service if needed if (locationHelper.isLiveSync() && DbAccess.needsSync(this)) { startService(syncIntent); WebSyncService.enqueueWork(this, syncIntent); } } catch (LocationHelper.LoggerException e) { int errorCode = e.getCode(); Loading app/src/main/java/net/fabiszewski/ulogger/MainActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -197,7 +197,7 @@ public class MainActivity extends AppCompatActivity if (data != null) { Intent intent = new Intent(MainActivity.this, GpxExportService.class); intent.setData(data.getData()); startService(intent); GpxExportService.enqueueWork(this, intent); showToast(getString(R.string.export_started)); } } Loading app/src/main/java/net/fabiszewski/ulogger/WebSyncService.java +9 −6 Original line number Diff line number Diff line Loading @@ -10,13 +10,15 @@ package net.fabiszewski.ulogger; import android.app.AlarmManager; import android.app.IntentService; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.util.Log; import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; import org.json.JSONException; import java.io.IOException; Loading @@ -36,7 +38,7 @@ import static android.app.PendingIntent.FLAG_ONE_SHOT; * */ public class WebSyncService extends IntentService { public class WebSyncService extends JobIntentService { private static final String TAG = WebSyncService.class.getSimpleName(); public static final String BROADCAST_SYNC_FAILED = "net.fabiszewski.ulogger.broadcast.sync_failed"; Loading @@ -48,12 +50,13 @@ public class WebSyncService extends IntentService { final private static int FIVE_MINUTES = 1000 * 60 * 5; static final int JOB_ID = 1001; /** * Constructor * Convenience method for enqueuing work in to this service. */ public WebSyncService() { super("WebSyncService"); static void enqueueWork(Context context, Intent work) { enqueueWork(context, WebSyncService.class, JOB_ID, work); } @Override Loading @@ -71,7 +74,7 @@ public class WebSyncService extends IntentService { * @param intent Intent */ @Override protected void onHandleIntent(Intent intent) { protected void onHandleWork(@NonNull Intent intent) { if (Logger.DEBUG) { Log.d(TAG, "[websync start]"); } cancelPending(); Loading Loading
app/src/main/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -45,9 +45,11 @@ android:foregroundServiceType="location" /> <service android:name=".WebSyncService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" /> <service android:name=".GpxExportService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="false" /> <receiver Loading
app/src/main/java/net/fabiszewski/ulogger/GpxExportService.java +14 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ package net.fabiszewski.ulogger; import android.app.IntentService; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Uri; Loading @@ -17,6 +17,7 @@ import android.util.Log; import android.util.Xml; import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; import org.xmlpull.v1.XmlSerializer; Loading @@ -27,7 +28,7 @@ import java.io.OutputStream; /** * Export track to GPX format */ public class GpxExportService extends IntentService { public class GpxExportService extends JobIntentService { private static final String TAG = GpxExportService.class.getSimpleName(); Loading @@ -43,12 +44,17 @@ public class GpxExportService extends IntentService { public static final String GPX_EXTENSION = ".gpx"; public static final String GPX_MIME = "application/gpx+xml"; public GpxExportService() { super("GpxExportService"); } private DbAccess db; static final int JOB_ID = 1000; /** * Convenience method for enqueuing work in to this service. */ static void enqueueWork(Context context, Intent work) { enqueueWork(context, GpxExportService.class, JOB_ID, work); } @Override public void onCreate() { super.onCreate(); Loading @@ -75,8 +81,8 @@ public class GpxExportService extends IntentService { * @param intent Intent */ @Override protected void onHandleIntent(Intent intent) { if (intent != null && intent.getData() != null) { protected void onHandleWork(@NonNull Intent intent) { if (intent.getData() != null) { try { write(intent.getData()); sendBroadcast(BROADCAST_EXPORT_DONE, null); Loading
app/src/main/java/net/fabiszewski/ulogger/LoggerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class LoggerService extends Service { // start websync service if needed if (locationHelper.isLiveSync() && DbAccess.needsSync(this)) { startService(syncIntent); WebSyncService.enqueueWork(this, syncIntent); } } catch (LocationHelper.LoggerException e) { int errorCode = e.getCode(); Loading
app/src/main/java/net/fabiszewski/ulogger/MainActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -197,7 +197,7 @@ public class MainActivity extends AppCompatActivity if (data != null) { Intent intent = new Intent(MainActivity.this, GpxExportService.class); intent.setData(data.getData()); startService(intent); GpxExportService.enqueueWork(this, intent); showToast(getString(R.string.export_started)); } } Loading
app/src/main/java/net/fabiszewski/ulogger/WebSyncService.java +9 −6 Original line number Diff line number Diff line Loading @@ -10,13 +10,15 @@ package net.fabiszewski.ulogger; import android.app.AlarmManager; import android.app.IntentService; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.util.Log; import androidx.annotation.NonNull; import androidx.core.app.JobIntentService; import org.json.JSONException; import java.io.IOException; Loading @@ -36,7 +38,7 @@ import static android.app.PendingIntent.FLAG_ONE_SHOT; * */ public class WebSyncService extends IntentService { public class WebSyncService extends JobIntentService { private static final String TAG = WebSyncService.class.getSimpleName(); public static final String BROADCAST_SYNC_FAILED = "net.fabiszewski.ulogger.broadcast.sync_failed"; Loading @@ -48,12 +50,13 @@ public class WebSyncService extends IntentService { final private static int FIVE_MINUTES = 1000 * 60 * 5; static final int JOB_ID = 1001; /** * Constructor * Convenience method for enqueuing work in to this service. */ public WebSyncService() { super("WebSyncService"); static void enqueueWork(Context context, Intent work) { enqueueWork(context, WebSyncService.class, JOB_ID, work); } @Override Loading @@ -71,7 +74,7 @@ public class WebSyncService extends IntentService { * @param intent Intent */ @Override protected void onHandleIntent(Intent intent) { protected void onHandleWork(@NonNull Intent intent) { if (Logger.DEBUG) { Log.d(TAG, "[websync start]"); } cancelPending(); Loading