Skip to content

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.

Quick improvements: Settings save automatically, Check for updates, short spoken alerts, Cells chip with tower dots on the map, setup wizard covers voice, bubble, car start, camera and cell alerts

CIS-C02d35baa7395a
diff --git a/README.md b/README.md
index 07019c6..a2f45a4 100644
--- a/README.md
+++ b/README.md
@@ -121,13 +121,14 @@ Every match shows its evidence, its source and a confidence tier: **weak** (< 50
**Alerts**
- Sound, vibration pattern per tier (1 / 2 / 3 pulses) and spoken announcements through the phone's own speech engine (prioritised, voice and speed pickers)
+- **Short spoken alerts** option ("Body cam", "Police car", "Speed camera, 50")
- Discreet mode, adjustable alert threshold, mute from the app or the car
- **Floating threat bubble** over Waze, Google Maps or any app
- Notification, Quick Settings tile and home-screen widget
**Map & history**
- OpenStreetMap map with your GPS trace and every device pinned exactly where its signal peaked (tap a spot to list everything heard there), the same filter chips as the list, self-centering
-- Optional **cell tower layer**: every tower seen while scanning, at the spot where its signal was strongest
+- Optional **cell tower layer** (or the map's **Cells** chip): every tower seen while scanning, at the spot where its signal was strongest
- **Record traces** of your route and the devices along it, with the screen off
- **History map & timeline:** heatmap of where flagged equipment showed up, and when (hour of day, day of week)
@@ -146,7 +147,8 @@ Every match shows its evidence, its source and a confidence tier: **weak** (< 50
- **Cell towers in the live list:** the serving cell and its neighbours appear under *All*, after the devices
- **Scan watchdog:** a scanner that goes silent is restarted on its own
- Device details: evidence, identity, decoded data, signal graph, **Locate** mode, history, raw advertisement
-- Setup wizard (theme, region, alerts, camera radius, screen, permissions)
+- Setup wizard (theme, region, alerts and voice, bubble, car start, camera warnings, cell alerts, camera radius, screen, permissions); Settings save themselves
+- **Check for updates** (menu ⋮): compares with the latest GitHub release, only when you tap it
- 13 themes, including the **DedSec** (Watch Dogs 2) and **fsociety** (Mr. Robot) fan themes
**Data & privacy**
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
index 05de8d4..5d377ff 100644
--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
@@ -542,6 +542,7 @@ class MainActivity : AppCompatActivity() {
R.id.action_traces -> { startActivity(Intent(this, com.rfsentinel.app.ui.TripsActivity::class.java)); true }
R.id.action_history -> { startActivity(Intent(this, com.rfsentinel.app.ui.HistoryActivity::class.java)); true }
R.id.action_about -> { AboutDialog.show(this); true }
+ R.id.action_check_update -> { com.rfsentinel.app.util.UpdateChecker.check(this); true }
R.id.action_mute -> {
val muted = !Prefs.alertsMuted(this)
Prefs.setAlertsMuted(this, muted)
diff --git a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt
index b115918..36f72ce 100644
--- a/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt
+++ b/app/src/main/java/com/rfsentinel/app/service/ScanForegroundService.kt
@@ -472,7 +472,7 @@ class ScanForegroundService : Service() {
)
) {
NotificationHelper.sendAlert(this, mac, best, a.rssi, following = true)
- AlertPlayer.play(this, best.tier, "Warning. ${best.label} may be following you.", following = true)
+ AlertPlayer.play(this, best.tier, com.rfsentinel.app.util.Spoken.device(this, best, following = true), following = true)
}
}
@@ -561,7 +561,7 @@ class ScanForegroundService : Service() {
if (now - last <= window) return
lastAlerted[a.mac] = now
NotificationHelper.sendAlert(this, a.mac, best, a.rssi)
- AlertPlayer.play(this, best.tier, "${best.label} nearby")
+ AlertPlayer.play(this, best.tier, com.rfsentinel.app.util.Spoken.device(this, best))
}
private fun knownAlprActive() = (Prefs.knownAlprAlerts(this) || Prefs.speedCameraAlerts(this)) &&
@@ -605,7 +605,7 @@ class ScanForegroundService : Service() {
"OpenStreetMap (" + (if (alpr) "surveillance:type=ALPR" else "highway=speed_camera / enforcement") + "), ODbL"
)
NotificationHelper.sendMapAlert(this, "alpr:" + cam.osmId, hit)
- AlertPlayer.play(this, hit.tier, cam.spoken)
+ AlertPlayer.play(this, hit.tier, com.rfsentinel.app.util.Spoken.camera(this, cam))
break // one warning per fix is enough
}
}
diff --git a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
index 9644e8b..321c740 100644
--- a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
@@ -251,6 +251,9 @@ class SettingsActivity : AppCompatActivity() {
super.onDestroy()
}
+ /** True once the screen shows the saved values, so leaving it can save them back. */
+ private var loaded = false
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySettingsBinding.inflate(layoutInflater)
@@ -370,6 +373,7 @@ class SettingsActivity : AppCompatActivity() {
binding.soundSwitch.isChecked = Prefs.soundEnabled(this)
binding.vibrateSwitch.isChecked = Prefs.vibrateEnabled(this)
binding.voiceSwitch.isChecked = Prefs.voiceEnabled(this)
+ binding.shortVoiceSwitch.isChecked = Prefs.shortVoice(this)
setupVoiceControls()
binding.discreetSwitch.isChecked = Prefs.discreetMode(this)
binding.bubbleSwitch.isChecked = Prefs.threatBubble(this) && Settings.canDrawOverlays(this)
@@ -490,7 +494,7 @@ class SettingsActivity : AppCompatActivity() {
}
}
- binding.saveButton.setOnClickListener { save() }
+ loaded = true
}
override fun onResume() {
@@ -553,6 +557,12 @@ class SettingsActivity : AppCompatActivity() {
.show()
}
+ /** Settings save themselves: whenever this screen is left (back, home, another screen). */
+ override fun onPause() {
+ super.onPause()
+ if (loaded) save()
+ }
+
private fun save() {
Prefs.setBleEnabled(this, binding.bleSwitch.isChecked)
Prefs.setWifiEnabled(this, binding.wifiSwitch.isChecked)
@@ -587,6 +597,7 @@ class SettingsActivity : AppCompatActivity() {
Prefs.setSoundEnabled(this, binding.soundSwitch.isChecked)
Prefs.setVibrateEnabled(this, binding.vibrateSwitch.isChecked)
Prefs.setVoiceEnabled(this, binding.voiceSwitch.isChecked)
+ Prefs.setShortVoice(this, binding.shortVoiceSwitch.isChecked)
Prefs.setDiscreetMode(this, binding.discreetSwitch.isChecked)
Prefs.setThreatBubble(this, binding.bubbleSwitch.isChecked)
if (!binding.bubbleSwitch.isChecked) com.rfsentinel.app.ui.ThreatBubble.hide(this)
@@ -614,7 +625,6 @@ class SettingsActivity : AppCompatActivity() {
// Re-deliver a start command so a running scanner picks up the changes.
if (ScanForegroundService.isRunning) ScanForegroundService.start(this)
- finish()
}
override fun onSupportNavigateUp(): Boolean {
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/MapActivity.kt
index 4604028..5074365 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/MapActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/MapActivity.kt
@@ -239,7 +239,7 @@ class MapActivity : AppCompatActivity() {
}
private fun setupFilterChips() {
- val options = if (tripId == null) DeviceFilter.entries - DeviceFilter.CELLS else listOf(DeviceFilter.ALL, DeviceFilter.FLAGGED)
+ val options = if (tripId == null) DeviceFilter.entries else listOf(DeviceFilter.ALL, DeviceFilter.FLAGGED)
filter = DeviceFilter.parse(com.rfsentinel.app.util.Prefs.mapFilter(this)).takeIf { it in options } ?: DeviceFilter.ALL
val group = binding.mapFilterChips
for (f in options) {
@@ -259,6 +259,7 @@ class MapActivity : AppCompatActivity() {
filter = picked
com.rfsentinel.app.util.Prefs.setMapFilter(this, picked.name)
if (tripId != null) loadTrip() else renderLive()
+ drawTowers()
}
}
@@ -266,7 +267,7 @@ class MapActivity : AppCompatActivity() {
private fun updateFilterCounts(devices: List<DeviceRegistry.Snapshot>) {
val placed = devices.filter { it.bestPosition != null }
for ((f, chip) in filterChips) {
- val n = placed.count { f.matches(it) }
+ val n = if (f == DeviceFilter.CELLS) towerCount else placed.count { f.matches(it) }
chip.text = if (f == DeviceFilter.ALL || n > 0) "${f.label} $n" else f.label
}
}
@@ -646,8 +647,14 @@ class MapActivity : AppCompatActivity() {
.show()
}
+ /** Towers with a map position (the Cells chip's count), refreshed with the layer. */
+ private var towerCount = 0
+
private fun drawTowers() {
- towers.points = if (tripId != null || !com.rfsentinel.app.util.Prefs.showCellTowers(this)) emptyList()
+ towerCount = com.rfsentinel.app.service.CellTowerStore.all(this).count { it.bestLat != null }
+ // The Cells chip shows the towers (only them); otherwise the map menu's switch decides.
+ val show = filter == DeviceFilter.CELLS || com.rfsentinel.app.util.Prefs.showCellTowers(this)
+ towers.points = if (tripId != null || !show) emptyList()
else com.rfsentinel.app.service.CellTowerStore.all(this).filter { it.bestLat != null }.map {
PointsOverlay.Point(it.bestLat!!, it.bestLon!!, it, icon = towerIcon)
}
diff --git a/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
index 13184dc..481c872 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
@@ -192,6 +192,18 @@ class SetupActivity : AppCompatActivity() {
switch("Alert sound", Prefs.soundEnabled(this)) { Prefs.setSoundEnabled(this, it) }
switch("Vibration (1 pulse weak, 2 probable, 3 strong)", Prefs.vibrateEnabled(this)) { Prefs.setVibrateEnabled(this, it) }
switch("Spoken alerts (\"Axon body camera nearby\")", Prefs.voiceEnabled(this)) { Prefs.setVoiceEnabled(this, it) }
+ switch("Short spoken alerts (\"Body cam\", \"Police car\", \"Speed camera, 50\")", Prefs.shortVoice(this)) { Prefs.setShortVoice(this, it) }
+ switch("Floating threat bubble over other apps (Waze, Google Maps...)",
+ Prefs.threatBubble(this) && android.provider.Settings.canDrawOverlays(this)) { on ->
+ Prefs.setThreatBubble(this, on)
+ if (on && !android.provider.Settings.canDrawOverlays(this)) {
+ // Android asks for "Display over other apps" on its own screen.
+ runCatching {
+ startActivity(android.content.Intent(android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
+ android.net.Uri.parse("package:$packageName")))
+ }
+ }
+ }
switch("Discreet mode - hide details on the lock screen and in notifications", Prefs.discreetMode(this)) {
Prefs.setDiscreetMode(this, it)
}
@@ -216,7 +228,7 @@ class SetupActivity : AppCompatActivity() {
}
private fun location() {
- header("Location features", "These use GPS while scanning. Everything stays on this phone.")
+ header("Driving & location", "GPS features, the car and known cameras. Everything stays on this phone.")
switch("Warn me when a tracker or flagged device keeps moving with me", Prefs.followerAlerts(this)) {
Prefs.setFollowerAlerts(this, it)
}
@@ -229,6 +241,22 @@ class SetupActivity : AppCompatActivity() {
switch("Start scanning automatically when the phone boots", Prefs.autoStartOnBoot(this)) {
Prefs.setAutoStartOnBoot(this, it)
}
+ switch("Start scanning in the car (Android Auto; pick your car's Bluetooth later in Settings)", Prefs.carAutoStart(this)) {
+ Prefs.setCarAutoStart(this, it)
+ }
+ label("Known cameras")
+ switch("Warn me before plate-reader cameras mapped in OpenStreetMap", Prefs.knownAlprAlerts(this)) {
+ Prefs.setKnownAlprAlerts(this, it)
+ }
+ switch("Warn me before speed and red-light cameras", Prefs.speedCameraAlerts(this)) {
+ Prefs.setSpeedCameraAlerts(this, it)
+ }
+ label("Cell network")
+ switch("Alert when the serving cell tower changes (frequent while driving; useful when parked)", Prefs.cellChangeAlerts(this)) {
+ Prefs.setCellChangeAlerts(this, it)
+ }
+ para("Extra hardware works on its own once plugged in while scanning: ESP32 boards (OUI-Spy, GhostESP) " +
+ "and USB WiFi adapters such as the ALFA AWUS036ACS. An OUI-SPY board over Bluetooth is paired in Settings.", small = true)
}
private fun permissions() {
diff --git a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
index 9d859c5..db91ed8 100644
--- a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
+++ b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
@@ -145,6 +145,10 @@ object Prefs {
fun setDeflockUpdated(context: Context, time: Long) = sp(context).edit { putLong("deflock_updated", time) }
fun ouiSpyRelayAll(context: Context): Boolean = bool(context, "ouispy_relay_all", true)
fun setOuiSpyRelayAll(context: Context, value: Boolean) = setBool(context, "ouispy_relay_all", value)
+ /** Two- or three-word spoken alerts ("Body cam", "Speed camera, 50") instead of full labels. */
+ fun shortVoice(context: Context): Boolean = bool(context, "short_voice", false)
+ fun setShortVoice(context: Context, value: Boolean) = setBool(context, "short_voice", value)
+
/** Alert each time the phone switches to another serving cell tower (off by default: frequent while driving). */
fun cellChangeAlerts(context: Context): Boolean = bool(context, "cell_change_alerts", false)
fun setCellChangeAlerts(context: Context, value: Boolean) = setBool(context, "cell_change_alerts", value)
diff --git a/app/src/main/java/com/rfsentinel/app/util/Spoken.kt b/app/src/main/java/com/rfsentinel/app/util/Spoken.kt
new file mode 100644
index 0000000..5b3a42e
--- /dev/null
+++ b/app/src/main/java/com/rfsentinel/app/util/Spoken.kt
@@ -0,0 +1,43 @@
+package com.rfsentinel.app.util
+
+import android.content.Context
+import com.rfsentinel.app.alpr.KnownCamera
+import com.rfsentinel.app.detect.Category
+import com.rfsentinel.app.detect.Hit
+
+/**
+ * The words spoken for an alert: the full label, or two or three words with
+ * Settings > Short spoken alerts ("Body cam", "Police car", "Speed camera, 50").
+ */
+object Spoken {
+
+ fun short(context: Context) = Prefs.shortVoice(context)
+
+ fun device(context: Context, hit: Hit, following: Boolean = false): String {
+ if (!short(context)) return if (following) "Warning. ${hit.label} may be following you." else "${hit.label} nearby"
+ val word = shortWord(hit)
+ return if (following) "$word following" else word
+ }
+
+ fun camera(context: Context, cam: KnownCamera): String {
+ if (!short(context)) return cam.spoken
+ return when (cam.type) {
+ KnownCamera.Kind.ALPR -> "Plate camera"
+ KnownCamera.Kind.SPEED -> "Speed camera" + (cam.maxspeed?.let { ", $it" } ?: "")
+ KnownCamera.Kind.RED_LIGHT -> "Red light camera"
+ }
+ }
+
+ fun shortWord(hit: Hit): String = when (hit.category) {
+ Category.BODY_CAM -> "Body cam"
+ Category.ALPR -> "Plate camera"
+ Category.AUDIO_SENSOR -> "Audio sensor"
+ Category.PUBLIC_SAFETY -> if (hit.label.contains("police vehicle", ignoreCase = true)) "Police car" else "Police gear"
+ Category.DRONE -> "Drone"
+ Category.TRACKER -> "Tracker"
+ Category.GLASSES -> "Camera glasses"
+ Category.NETWORK_CAMERA -> "Camera"
+ Category.CELL_ANOMALY -> "Cell warning"
+ Category.CUSTOM -> "Watchlist"
+ }
+}
diff --git a/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt b/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt
new file mode 100644
index 0000000..39abf73
--- /dev/null
+++ b/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt
@@ -0,0 +1,96 @@
+package com.rfsentinel.app.util
+
+import android.content.Intent
+import android.net.Uri
+import android.widget.Toast
+import androidx.appcompat.app.AlertDialog
+import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.lifecycleScope
+import com.rfsentinel.app.BuildConfig
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+import org.json.JSONObject
+import java.net.HttpURLConnection
+import java.net.URL
+
+/**
+ * "Check for updates": asks GitHub for the latest release, only when tapped.
+ * GitHub sees the request (your IP address); nothing about your scans is sent.
+ */
+object UpdateChecker {
+
+ private const val API = "https://api.github.com/repos/CIS-C0/RFSentinel/releases/latest"
+ private const val RELEASES = "https://github.com/CIS-C0/RFSentinel/releases/latest"
+
+ data class Latest(val version: String, val apkUrl: String?, val notesUrl: String)
+
+ /** True when [a] is a newer dotted version than [b] ("2.11.1" > "2.11.0"). */
+ fun isNewer(a: String, b: String): Boolean {
+ val x = a.trimStart('v', 'V').split('.', '-').map { it.toIntOrNull() ?: 0 }
+ val y = b.trimStart('v', 'V').split('.', '-').map { it.toIntOrNull() ?: 0 }
+ for (i in 0 until maxOf(x.size, y.size)) {
+ val d = x.getOrElse(i) { 0 } - y.getOrElse(i) { 0 }
+ if (d != 0) return d > 0
+ }
+ return false
+ }
+
+ private fun fetch(): Latest {
+ val conn = (URL(API).openConnection() as HttpURLConnection).apply {
+ connectTimeout = 10_000; readTimeout = 10_000
+ setRequestProperty("Accept", "application/vnd.github+json")
+ setRequestProperty("User-Agent", "${BuildConfig.APPLICATION_ID}/${BuildConfig.VERSION_NAME}")
+ }
+ try {
+ if (conn.responseCode != 200) throw IllegalStateException("GitHub answered ${conn.responseCode}")
+ val json = JSONObject(conn.inputStream.bufferedReader().use { it.readText() })
+ val assets = json.optJSONArray("assets")
+ var apk: String? = null
+ if (assets != null) for (i in 0 until assets.length()) {
+ val a = assets.getJSONObject(i)
+ if (a.optString("name").endsWith("-release.apk")) apk = a.optString("browser_download_url")
+ }
+ return Latest(json.getString("tag_name").trimStart('v'), apk, json.optString("html_url", RELEASES))
+ } finally {
+ conn.disconnect()
+ }
+ }
+
+ fun check(activity: AppCompatActivity) {
+ Toast.makeText(activity, "Checking for updates…", Toast.LENGTH_SHORT).show()
+ activity.lifecycleScope.launch {
+ val result = withContext(Dispatchers.IO) { runCatching { fetch() } }
+ if (activity.isFinishing) return@launch
+ val latest = result.getOrElse {
+ AlertDialog.Builder(activity)
+ .setTitle("Couldn't check for updates")
+ .setMessage("GitHub couldn't be reached (${it.message ?: "no connection"}). You can look at the releases page instead.")
+ .setPositiveButton("Open releases") { _, _ -> open(activity, RELEASES) }
+ .setNegativeButton("Close", null)
+ .show()
+ return@launch
+ }
+ val current = BuildConfig.VERSION_NAME.substringBefore('-')
+ if (isNewer(latest.version, current)) {
+ AlertDialog.Builder(activity)
+ .setTitle("RF Sentinel ${latest.version} is available")
+ .setMessage("You have $current. Download the new APK and install it over this one - your history and settings are kept.")
+ .setPositiveButton("Download") { _, _ -> open(activity, latest.apkUrl ?: latest.notesUrl) }
+ .setNeutralButton("What's new") { _, _ -> open(activity, latest.notesUrl) }
+ .setNegativeButton("Later", null)
+ .show()
+ } else {
+ AlertDialog.Builder(activity)
+ .setTitle("You're up to date")
+ .setMessage("RF Sentinel $current is the latest version.")
+ .setPositiveButton("OK", null)
+ .show()
+ }
+ }
+ }
+
+ private fun open(activity: AppCompatActivity, url: String) {
+ runCatching { activity.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) }
+ }
+}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 25808dc..def5442 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -251,6 +251,12 @@
android:layout_height="wrap_content"
android:text="Spoken alerts (e.g. while driving)" />
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/shortVoiceSwitch"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Short spoken alerts (&quot;Body cam&quot;, &quot;Police car&quot;, &quot;Speed camera, 50&quot;)" />
+
<TextView style="@style/SettingsLabel" android:text="Voice speed" />
<RadioGroup
@@ -574,12 +580,11 @@
android:layout_height="wrap_content"
android:text="Clear match history" />
- <Button
- android:id="@+id/saveButton"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:text="Save" />
+ <TextView
+ style="@style/SettingsLabel"
+ android:paddingTop="16dp"
+ android:textSize="12sp"
+ android:text="Changes are saved automatically." />
</LinearLayout>
</ScrollView>
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index fe9a9b5..86a5cd2 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -20,5 +20,6 @@
<item android:id="@+id/action_settings" android:title="Settings" app:showAsAction="never" />
<item android:id="@+id/action_export_all" android:title="Export all devices..." app:showAsAction="never" />
<item android:id="@+id/action_export" android:title="Export (history, matches, everything)..." app:showAsAction="never" />
+ <item android:id="@+id/action_check_update" android:title="Check for updates" app:showAsAction="never" />
<item android:id="@+id/action_about" android:title="About &amp; sources" app:showAsAction="never" />
</menu>
diff --git a/app/src/test/java/com/rfsentinel/app/util/UpdateAndSpokenTest.kt b/app/src/test/java/com/rfsentinel/app/util/UpdateAndSpokenTest.kt
new file mode 100644
index 0000000..fc56da1
--- /dev/null
+++ b/app/src/test/java/com/rfsentinel/app/util/UpdateAndSpokenTest.kt
@@ -0,0 +1,31 @@
+package com.rfsentinel.app.util
+
+import com.rfsentinel.app.detect.Category
+import com.rfsentinel.app.detect.Hit
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
+import org.junit.Test
+
+class UpdateAndSpokenTest {
+
+ @Test
+ fun versionsCompareNumerically() {
+ assertTrue(UpdateChecker.isNewer("2.11.1", "2.11.0"))
+ assertTrue(UpdateChecker.isNewer("v2.12.0", "2.11.9"))
+ assertTrue(UpdateChecker.isNewer("2.11.10", "2.11.9")) // not a string comparison
+ assertFalse(UpdateChecker.isNewer("2.11.0", "2.11.0"))
+ assertFalse(UpdateChecker.isNewer("2.10.6", "2.11.0"))
+ assertTrue(UpdateChecker.isNewer("3.0", "2.11.0"))
+ }
+
+ private fun hit(c: Category, label: String) = Hit(c, label, 80, "", "")
+
+ @Test
+ fun shortWordsAreShort() {
+ assertEquals("Body cam", Spoken.shortWord(hit(Category.BODY_CAM, "Axon body camera")))
+ assertEquals("Police car", Spoken.shortWord(hit(Category.PUBLIC_SAFETY, "Two-way radio in a possible police vehicle (3 kinds of gear together)")))
+ assertEquals("Police gear", Spoken.shortWord(hit(Category.PUBLIC_SAFETY, "Motorola Solutions equipment")))
+ Category.entries.forEach { c -> assertTrue(Spoken.shortWord(hit(c, "x")).split(' ').size <= 2) }
+ }
+}