RF Sentinel (RFSentinel): free, open-source police detector app for Android. Spots police body cams, Flock ALPR cameras, AirTag trackers, Remote ID drones, smart glasses and fake cell towers from Bluetooth LE and WiFi. No root.
Kotlin airtagalprandroidandroid-autoanti-surveillancebluetooth-low-energybody-cameracounter-surveillancedrone-detectionflock-safetyimsi-catcher-detectorpolice-detectorpolice-scannerprivacyremote-idrtl-sdrsdrsurveillance-detectiontracker-detectionwifi
GPS dot on the main screen's status: red without a position, yellow rougher than 20 m, green from 20 m down, with the accuracy
CIS-C0cca0bf040a02
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.ktindex 203fac5..140d30f 100644--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt@@ -496,13 +496,14 @@ class MainActivity : AppCompatActivity() {com.rfsentinel.app.link.PhoneLink.status.takeIf { it.isNotBlank() }?.let { com.rfsentinel.app.ui.StatusPanel.Hardware(it) },com.rfsentinel.app.link.MeshNode.status.takeIf { it.isNotBlank() }?.let { com.rfsentinel.app.ui.StatusPanel.Hardware(it) })- statusPanel.update(running, warning, hardware, if (locationOff) ::openLocationSettings else null)+ statusPanel.update(running, warning, hardware, if (locationOff) ::openLocationSettings else null,+ if (running && !locationOff) com.rfsentinel.app.ui.GpsDot.text(this, demoMode) else null)return}val locationOff = running && !locationOn() && !demoModeif (locationOff) binding.statusText.setOnClickListener { openLocationSettings() }else { binding.statusText.setOnClickListener(null); binding.statusText.isClickable = false }- binding.statusText.text = when {+ val line: CharSequence = when {!running -> "Idle - tap Start to listen for nearby devices"locationOff -> "⚠ $LOCATION_OFF"!bluetoothOn() && !demoMode -> "Scanning WiFi only - turn on Bluetooth for BLE (picked up automatically)"@@ -524,6 +525,8 @@ class MainActivity : AppCompatActivity() {com.rfsentinel.app.link.PhoneLink.status.takeIf { it.isNotBlank() }?.let { "\n$it" }.orEmpty() +com.rfsentinel.app.link.MeshNode.status.takeIf { it.isNotBlank() }?.let { "\n$it" }.orEmpty()}+ binding.statusText.text = if (running && !locationOff)+ android.text.SpannableStringBuilder(com.rfsentinel.app.ui.GpsDot.text(this, demoMode)).append(" · ").append(line) else line}/**diff --git a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.ktindex 525c786..bfee8d2 100644--- a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt+++ b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt@@ -72,6 +72,9 @@ class ScanForegroundService : Service() {private const val RADAR_HOLD_MS = 120_000L/** "GPS connected" again only after the fix was lost this long. */private const val GPS_RECONNECT_MS = 120_000L+ /** The latest position's time and accuracy, for the GPS dot (null: none while scanning). */+ @Volatile var gpsAt = 0L; private set+ @Volatile var gpsAccuracyM: Float? = null; private set/** No fused fix this long after asking (precise / balanced): raw GPS and network fill in. */private const val FUSED_SILENT_FAST_MS = 15_000Lprivate const val FUSED_SILENT_MS = 30_000L@@ -267,6 +270,7 @@ class ScanForegroundService : Service() {}lastLocation = itlastFix = it+ if (it.hasAccuracy()) { gpsAt = System.currentTimeMillis(); gpsAccuracyM = it.accuracy }com.rfsentinel.app.ui.MapGps.offer(it)TripRecorder.onLocation(it)checkKnownAlpr(it)@@ -351,6 +355,7 @@ class ScanForegroundService : Service() {DeviceRegistry.startSession()classified.clear()lastGoodGpsAt = 0L+ gpsAt = 0L; gpsAccuracyM = nullAlertPlayer.preload(this)AlertPlayer.startup(this)serviceScope.launch { pruneOldData() }diff --git a/app/src/main/java/com/rfsentinel/app/ui/GpsDot.kt b/app/src/main/java/com/rfsentinel/app/ui/GpsDot.ktnew file mode 100644index 0000000..74bb74a--- /dev/null+++ b/app/src/main/java/com/rfsentinel/app/ui/GpsDot.kt@@ -0,0 +1,40 @@+package com.rfsentinel.app.ui++import android.content.Context+import android.text.SpannableStringBuilder+import android.text.Spanned+import android.text.style.ForegroundColorSpan+import com.rfsentinel.app.service.ScanForegroundService++/**+ * The GPS dot on the main screen's status: red without a position (or one older than [STALE_MS]),+ * yellow while it's rougher than [GOOD_M], green from [GOOD_M] down, with the accuracy beside it.+ */+object GpsDot {++ const val GOOD_M = 20f+ const val STALE_MS = 10_000L++ enum class Level(val color: Int, val words: String) {+ NONE(0xFFB3261E.toInt(), "no position"),+ ROUGH(0xFFE0A33A.toInt(), "rough"),+ GOOD(0xFF2E7D32.toInt(), "good")+ }++ fun level(at: Long, accuracyM: Float?, now: Long): Level = when {+ accuracyM == null || now - at > STALE_MS -> Level.NONE+ accuracyM > GOOD_M -> Level.ROUGH+ else -> Level.GOOD+ }++ /** "● GPS 8 m" (or "● GPS - no position") with the dot coloured, for a status line. */+ fun text(context: Context, demo: Boolean = false): CharSequence {+ val now = System.currentTimeMillis()+ val acc = if (demo) 5f else ScanForegroundService.gpsAccuracyM+ val lv = if (demo) Level.GOOD else level(ScanForegroundService.gpsAt, acc, now)+ val b = SpannableStringBuilder("●")+ b.setSpan(ForegroundColorSpan(ThemeManager.ink(context, lv.color)), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)+ b.append(if (lv == Level.NONE) " GPS - no position" else " GPS ${acc!!.toInt()} m")+ return b+ }+}diff --git a/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.kt b/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.ktindex 4bbbc5c..3c31a84 100644--- a/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.kt@@ -33,6 +33,8 @@ class StatusPanel(private val context: Context) {val root = LinearLayout(context).apply { orientation = LinearLayout.VERTICAL; visibility = View.GONE }private val note = TextView(context).apply { textSize = 12f }+ /** The GPS dot and accuracy while scanning ([GpsDot]). */+ private val gps = TextView(context).apply { textSize = 12f; visibility = View.GONE }private val noteHide = iconButton("✕", "Hide this warning")private val noteRow = LinearLayout(context).apply { orientation = LinearLayout.HORIZONTAL; gravity = Gravity.CENTER_VERTICAL; visibility = View.GONE }/** The warning hidden with its ✕; a different one shows again. */@@ -75,6 +77,7 @@ class StatusPanel(private val context: Context) {noteHide.setOnClickListener {hiddenWarning = shownWarning; noteRow.visibility = View.GONE; onWarningHidden?.invoke()}+ root.addView(gps, LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = (4 * dp).toInt() })root.addView(noteRow, LinearLayout.LayoutParams(-1, -2).apply { bottomMargin = (4 * dp).toInt() })root.addView(strip, LinearLayout.LayoutParams(-1, -2))root.addView(cards)@@ -97,7 +100,9 @@ class StatusPanel(private val context: Context) {* [running]: scanning; [warning]: a fake-cell or restarted-scan note; [hardware]: the non-blank hardware status lines;* [onWarningTap]: what tapping the warning does (e.g. open the Location setting), null when it does nothing.*/- fun update(running: Boolean, warning: String?, hardware: List<Hardware>, onWarningTap: (() -> Unit)? = null) {+ fun update(running: Boolean, warning: String?, hardware: List<Hardware>, onWarningTap: (() -> Unit)? = null, gpsLine: CharSequence? = null) {+ gps.visibility = if (gpsLine == null) View.GONE else View.VISIBLE+ gps.text = gpsLineval grey = (ChipStyle.onSurface(context) and 0x00FFFFFF) or 0x99000000.toInt()// Idle needs no note here: the Start button says it.val shown = if (!running || warning == hiddenWarning) null else warning?.let { "⚠ $it" }