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
Warn when Location is off: Android hides every scan result, tap opens the setting
CIS-C0aadc1ff6c4cf
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.ktindex 249177e..193f7a8 100644--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt@@ -53,6 +53,8 @@ class MainActivity : AppCompatActivity() {/** Radio transmissions stay on the radar this long after they were last heard (the list keeps 5 minutes). */private const val RADIO_RADAR_MS = 60_000Lprivate const val BLUETOOTH_TAG_COLOR = 0xFF1565C0.toInt()+ /** Location off: Android gives the app no Bluetooth or WiFi results. Tapping the warning opens the setting. */+ private const val LOCATION_OFF = "Location is off - no devices can be seen. Tap to turn it on"private const val WIFI_TAG_COLOR = 0xFF00838F.toInt()private const val REFRESH_MS = 1_000Lprivate const val WEAK_COLOR = 0xFFB26A00.toInt()@@ -470,7 +472,9 @@ class MainActivity : AppCompatActivity() {statusPanel.root.visibility = if (visual) View.VISIBLE else View.GONEif (visual) {val now = System.currentTimeMillis()+ val locationOff = running && !locationOn() && !demoModeval warning = when {+ locationOff -> LOCATION_OFFrunning && !bluetoothOn() && !demoMode -> "Scanning WiFi only - turn on Bluetooth for BLE (picked up automatically)"else -> listOfNotNull(com.rfsentinel.app.service.CellMonitor.lastAnomaly?.takeIf { now - it.first < 15 * 60_000L }?.second?.title,@@ -494,11 +498,15 @@ 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)+ statusPanel.update(running, warning, hardware, if (locationOff) ::openLocationSettings else null)return}+ val locationOff = running && !locationOn() && !demoMode+ if (locationOff) binding.statusText.setOnClickListener { openLocationSettings() }+ else { binding.statusText.setOnClickListener(null); binding.statusText.isClickable = false }binding.statusText.text = 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)"else -> "Scanning · $deviceCount ${plural(deviceCount, "device", "devices")} nearby" +(if (flaggedCount > 0) " · $flaggedCount flagged" else "") +@@ -615,6 +623,18 @@ class MainActivity : AppCompatActivity() {private fun bluetoothOn(): Boolean =(getSystemService(BLUETOOTH_SERVICE) as? BluetoothManager)?.adapter?.isEnabled == true+ /** Android hides Bluetooth and WiFi scan results from the app while Location is off: nothing shows up at all. */+ private fun locationOn(): Boolean =+ (getSystemService(LOCATION_SERVICE) as? android.location.LocationManager)+ ?.let { androidx.core.location.LocationManagerCompat.isLocationEnabled(it) } != false++ private fun openLocationSettings() {+ try { startActivity(android.content.Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)) }+ catch (_: android.content.ActivityNotFoundException) {+ android.widget.Toast.makeText(this, "Turn Location on in the phone's quick settings", android.widget.Toast.LENGTH_LONG).show()+ }+ }+/** Rebuilds the live list / radar once a second while the screen is visible. */private fun observeDevices() {lifecycleScope.launch {diff --git a/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.kt b/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.ktindex cdd46f7..4bbbc5c 100644--- a/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.kt+++ b/app/src/main/java/com/rfsentinel/app/ui/StatusPanel.kt@@ -93,13 +93,18 @@ class StatusPanel(private val context: Context) {isFocusable = true}- /** [running]: scanning; [warning]: a fake-cell or restarted-scan note; [hardware]: the non-blank hardware status lines. */- fun update(running: Boolean, warning: String?, hardware: List<Hardware>) {+ /**+ * [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) {val 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" }shownWarning = warningnoteRow.visibility = if (shown != null) View.VISIBLE else View.GONE+ if (onWarningTap != null) note.setOnClickListener { onWarningTap() }+ else { note.setOnClickListener(null); note.isClickable = false }if (shown != null) {VisualMode.text(note, shown)VisualMode.chip(note, if (running) 0xFFE0A33A.toInt() else grey)