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.

Release 2.13.2: optional update check on app startup

CIS-C08fcaccee7a8c
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 977fc7f..85ead16 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -6,8 +6,8 @@ plugins {
}
// Bump both for every release. versionName ends up in the APK file name.
-val appVersionCode = 33
-val appVersionName = "2.13.1"
+val appVersionCode = 34
+val appVersionName = "2.13.2"
// Release signing credentials live in keystore.properties (git-ignored).
// Without that file, release builds are produced unsigned.
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
index fda13b5..1f4bd48 100644
--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
@@ -167,6 +167,7 @@ class MainActivity : AppCompatActivity() {
lifecycleScope.launch { Favorites.load(this@MainActivity) }
// Only on a real fresh start - a theme change recreates this screen too.
if (savedInstanceState == null && !Prefs.onboardingDone(this)) showOnboarding()
+ else if (savedInstanceState == null) com.rfsentinel.app.util.UpdateChecker.checkOnStartup(this)
}
override fun onResume() {
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 e3ab864..f33cbe0 100644
--- a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
@@ -477,6 +477,7 @@ class SettingsActivity : AppCompatActivity() {
binding.cellChangeSwitch.isChecked = Prefs.cellChangeAlerts(this)
binding.speedCameraSwitch.isChecked = Prefs.speedCameraAlerts(this)
binding.autoCamerasSwitch.isChecked = Prefs.autoCameras(this)
+ binding.autoUpdateSwitch.isChecked = Prefs.autoUpdateCheck(this)
fun showRadius(km: Int) {
binding.cameraRadiusText.text = "Download radius: $km km" +
if (km > 100) " (larger areas take longer and use more data)" else ""
@@ -672,6 +673,7 @@ class SettingsActivity : AppCompatActivity() {
Prefs.setCellChangeAlerts(this, binding.cellChangeSwitch.isChecked)
Prefs.setSpeedCameraAlerts(this, binding.speedCameraSwitch.isChecked)
Prefs.setAutoCameras(this, binding.autoCamerasSwitch.isChecked)
+ Prefs.setAutoUpdateCheck(this, binding.autoUpdateSwitch.isChecked)
Prefs.setRetentionDays(this, (binding.retentionInput.text.toString().toIntOrNull() ?: 90).coerceAtLeast(0))
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 1977097..d81f834 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
@@ -126,7 +126,7 @@ class SetupActivity : AppCompatActivity() {
header("Welcome to RF Sentinel", "A quick setup - about a minute. You can change everything later in Settings.")
para("RF Sentinel listens - passively - to the Bluetooth and WiFi signals devices around you already broadcast, and flags equipment such as body cameras, license-plate cameras, drones, trackers following you and camera glasses.")
bullet("It never transmits to, connects to or interferes with any device.")
- bullet("Scans, detections and history stay on this phone. Internet is only used for OpenStreetMap maps (including known plate, speed and red-light camera locations for the area you look at - can be turned off in Settings - and, in Android Auto, destination search and routes when you navigate).")
+ bullet("Scans, detections and history stay on this phone. Internet is only used for OpenStreetMap maps (including known plate, speed and red-light camera locations for the area you look at - can be turned off in Settings - and, in Android Auto, destination search and routes when you navigate) and GitHub when you check for updates.")
bullet("A match means a device with that signature is nearby - not proof of who is there.")
para("Check your local laws before use. This is not legal advice.", small = true)
}
@@ -244,6 +244,9 @@ class SetupActivity : AppCompatActivity() {
switch("Start scanning in the car (Android Auto; pick your car's Bluetooth later in Settings)", Prefs.carAutoStart(this)) {
Prefs.setCarAutoStart(this, it)
}
+ switch("Check for updates when the app opens (asks GitHub at most every 6 hours)", Prefs.autoUpdateCheck(this)) {
+ Prefs.setAutoUpdateCheck(this, it)
+ }
label("Known cameras")
switch("Warn me before plate-reader cameras mapped in OpenStreetMap", Prefs.knownAlprAlerts(this)) {
Prefs.setKnownAlprAlerts(this, it)
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 e262d37..f5f13d5 100644
--- a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
+++ b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
@@ -118,6 +118,12 @@ object Prefs {
fun autoCameras(context: Context): Boolean = bool(context, "auto_cameras", true)
fun setAutoCameras(context: Context, value: Boolean) = setBool(context, "auto_cameras", value)
+
+ /** Check GitHub for a new release when the app opens. Off by default: it contacts GitHub. */
+ fun autoUpdateCheck(context: Context): Boolean = bool(context, "auto_update_check", false)
+ fun setAutoUpdateCheck(context: Context, value: Boolean) = setBool(context, "auto_update_check", value)
+ fun lastUpdateCheck(context: Context): Long = sp(context).getLong("last_update_check", 0L)
+ fun setLastUpdateCheck(context: Context, value: Long) = sp(context).edit { putLong("last_update_check", value) }
/**
* Map device filter (a [com.rfsentinel.app.ui.DeviceFilter] name). Older
* versions had only "all devices" on/off: off becomes Flagged.
diff --git a/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt b/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt
index 9d9fffc..89d27ca 100644
--- a/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt
+++ b/app/src/main/java/com/rfsentinel/app/util/UpdateChecker.kt
@@ -57,11 +57,26 @@ object UpdateChecker {
}
}
- fun check(activity: AppCompatActivity) {
- Toast.makeText(activity, "Checking for updates…", Toast.LENGTH_SHORT).show()
+ private const val AUTO_INTERVAL_MS = 6 * 60 * 60 * 1000L
+
+ /**
+ * The startup check (Settings / setup wizard toggle): at most every 6 hours, and silent
+ * unless a newer version is out - no "checking", "up to date" or connection-error messages.
+ */
+ fun checkOnStartup(activity: AppCompatActivity) {
+ if (!Prefs.autoUpdateCheck(activity)) return
+ val now = System.currentTimeMillis()
+ if (now - Prefs.lastUpdateCheck(activity) < AUTO_INTERVAL_MS) return
+ Prefs.setLastUpdateCheck(activity, now)
+ check(activity, silent = true)
+ }
+
+ fun check(activity: AppCompatActivity, silent: Boolean = false) {
+ if (!silent) 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
+ if (activity.isFinishing || activity.isDestroyed) return@launch
+ if (silent && result.isFailure) return@launch
val latest = result.getOrElse {
AlertDialog.Builder(activity)
.setTitle("Couldn't check for updates")
@@ -80,7 +95,7 @@ object UpdateChecker {
.setNeutralButton("What's new") { _, _ -> open(activity, latest.notesUrl) }
.setNegativeButton("Later", null)
.show()
- } else {
+ } else if (!silent) {
AlertDialog.Builder(activity)
.setTitle("You're up to date")
.setMessage("RF Sentinel $current is the latest version.")
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 0ec9e53..da1cd40 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -16,6 +16,13 @@
android:layout_height="wrap_content"
android:text="Run the setup wizard again" />
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/autoUpdateSwitch"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:text="Check for updates when the app opens (asks GitHub at most every 6 hours; says something only when a new version is out)" />
+
<!-- ================= Appearance ================= -->
<TextView style="@style/SettingsHeader" android:text="Appearance" />