TrackerService.kt
| 1 | package net.lexcom.opentracker |
| 2 | |
| 3 | import android.app.Service |
| 4 | import android.content.Intent |
| 5 | import android.os.IBinder |
| 6 | import android.util.Log |
| 7 | |
| 8 | /** |
| 9 | * The `location`-type foreground service that will drive |
| 10 | * policy → source → frame → queue → uplink. |
| 11 | * |
| 12 | * Declared in the manifest from the start so the permission and |
| 13 | * `foregroundServiceType` wiring is validated by the build, but not yet |
| 14 | * implemented — nothing starts it. Filled in at step 9 of the implementation |
| 15 | * order, alongside `Notifications` and `PermissionGate`. |
| 16 | */ |
| 17 | class TrackerService : Service() { |
| 18 | override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { |
| 19 | // START_STICKY recreates the service after a low-memory kill, but with a |
| 20 | // null Intent — so state must come from Prefs, never from Intent extras. |
| 21 | Log.w(TAG, "TrackerService started before it was implemented; stopping") |
| 22 | stopSelf(startId) |
| 23 | return START_NOT_STICKY |
| 24 | } |
| 25 | |
| 26 | override fun onBind(intent: Intent?): IBinder? = null |
| 27 | |
| 28 | private companion object { |
| 29 | const val TAG = "OpenTracker" |
| 30 | } |
| 31 | } |
| 32 |