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.

FOSS flavor without the Mapbox SDK

CIS-C0ff3889f728f6
diff --git a/README.md b/README.md
index 9da6729..6f61d87 100644
--- a/README.md
+++ b/README.md
@@ -896,19 +896,23 @@ No root. Not on Google Play: the signed APK is on
Requirements: Android Studio, or JDK 17+ with the Android SDK (platform 37).
```bash
-./gradlew assembleDebug
+./gradlew assembleFossDebug
```
```bash
./gradlew testDebugUnitTest lintDebug
```
-Mapbox is optional: with `MAPBOX_ACCESS_TOKEN=pk...` (your own public token) in
+There are two flavors. **foss** contains only free software: no Mapbox SDK, the map is
+always OpenFreeMap. **full** adds the optional Mapbox map (`./gradlew assembleFullDebug`).
+Both have the same app ID, so either one replaces the other.
+
+In the full flavor, Mapbox is optional: with `MAPBOX_ACCESS_TOKEN=pk...` (your own public token) in
`local.properties` (git-ignored) the build offers the Mapbox map; without it the app
builds and runs on OpenFreeMap only. The Mapbox SDK downloads from Mapbox's public
Maven repository without an account.
-The debug APK is written to `app/build/outputs/apk/debug/`. `tools/gen_assets.py`
+The debug APKs are written to `app/build/outputs/apk/<flavor>/debug/`. `tools/gen_assets.py`
regenerates the offline IEEE and Bluetooth SIG databases. The website is built
from `site/` with `python tools/build_site.py` (see [site/README.md](site/README.md)).
@@ -922,7 +926,7 @@ from `site/` with `python tools/build_site.py` (see [site/README.md](site/README
<details>
<summary><b>Signed release builds</b></summary>
-`./gradlew assembleRelease` signs the APK using `keystore.properties` in the
+`./gradlew assembleRelease` builds both flavors and signs the APKs using `keystore.properties` in the
project root (git-ignored):
```properties
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 7716818..2d91c8a 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -54,6 +54,14 @@ android {
}
}
+ // full: everything, with the optional Mapbox map. foss: only free software (no Mapbox SDK), for F-Droid and
+ // anyone who wants it; the map is OpenFreeMap. Same app ID, so either one replaces the other.
+ flavorDimensions += "maps"
+ productFlavors {
+ create("full") { dimension = "maps" }
+ create("foss") { dimension = "maps" }
+ }
+
buildTypes {
debug {
// Installs next to the release app (demo data, screenshots) without touching it.
@@ -123,8 +131,8 @@ dependencies {
// where the phone has it and OpenGL ES everywhere else (the plain build is Vulkan-only and crashes the app on phones
// without Vulkan, e.g. Android 9 phones with a PowerVR GE8320).
implementation("org.maplibre.gl:android-sdk-vulkan-opengl:13.6.1")
- // Optional Mapbox map (Settings > Map > Map provider); needs MAPBOX_ACCESS_TOKEN in local.properties.
- implementation("com.mapbox.maps:android-ndk27:11.32.0")
+ // Optional Mapbox map (Settings > Map > Map provider), full build only; needs MAPBOX_ACCESS_TOKEN in local.properties.
+ "fullImplementation"("com.mapbox.maps:android-ndk27:11.32.0")
// Android Auto (Car App Library, template-based UI; "projected" = phone-driven Android Auto)
implementation("androidx.car.app:app:1.7.0")
diff --git a/app/src/foss/java/com/rfsentinel/app/ui/MapboxSupport.kt b/app/src/foss/java/com/rfsentinel/app/ui/MapboxSupport.kt
new file mode 100644
index 0000000..f768684
--- /dev/null
+++ b/app/src/foss/java/com/rfsentinel/app/ui/MapboxSupport.kt
@@ -0,0 +1,10 @@
+package com.rfsentinel.app.ui
+
+import android.content.Context
+
+/** The FOSS build has no Mapbox SDK: the map is always OpenFreeMap (MapLibre). */
+internal object MapboxSupport {
+ const val INCLUDED = false
+
+ fun engine(context: Context): MapEngine = MapLibreEngine(context)
+}
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapboxEngine.kt b/app/src/full/java/com/rfsentinel/app/ui/MapboxEngine.kt
similarity index 100%
rename from app/src/main/java/com/rfsentinel/app/ui/MapboxEngine.kt
rename to app/src/full/java/com/rfsentinel/app/ui/MapboxEngine.kt
diff --git a/app/src/full/java/com/rfsentinel/app/ui/MapboxSupport.kt b/app/src/full/java/com/rfsentinel/app/ui/MapboxSupport.kt
new file mode 100644
index 0000000..9b9a6ba
--- /dev/null
+++ b/app/src/full/java/com/rfsentinel/app/ui/MapboxSupport.kt
@@ -0,0 +1,10 @@
+package com.rfsentinel.app.ui
+
+import android.content.Context
+
+/** The full build: the optional Mapbox map (Mapbox Maps SDK, Mapbox terms). */
+internal object MapboxSupport {
+ const val INCLUDED = true
+
+ fun engine(context: Context): MapEngine = MapboxEngine(context)
+}
diff --git a/app/src/main/java/com/rfsentinel/app/ui/AboutDialog.kt b/app/src/main/java/com/rfsentinel/app/ui/AboutDialog.kt
index 78fb589..d30f44b 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/AboutDialog.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/AboutDialog.kt
@@ -17,15 +17,15 @@ object AboutDialog {
ABSOLUTELY NO WARRANTY. Source code: github.com/CIS-C0/RFSentinel<br/><br/>
Passive, receive-only Bluetooth LE and WiFi scanner. It never transmits to,
connects to, jams or spoofs any device. Scans, detections, history and traces stay
- on this phone. Internet is used only for map data: the map (OpenFreeMap, or Mapbox if
- you choose it in Settings), the road tiles of your area while the Waze "only ahead"
+ on this phone. Internet is used only for map data: the map (OpenFreeMap${if (MapEngine.mapboxAvailable) ", or Mapbox if you choose it in Settings" else ""}),
+ the road tiles of your area while the Waze "only ahead"
option is on, and the list of known plate, speed and red-light cameras for the area you look at on
screen; and, when you search for a destination or start a route (on the phone or in Android
Auto), the place search (Photon, and Nominatim for a search you submit), places of one kind near you or ahead on your route (the same
OpenStreetMap servers as the cameras) and the route (Valhalla, on the OpenStreetMap Germany server).
Those servers see your IP and that area or trip, never your scans or detections.
Map data &copy; OpenStreetMap contributors (ODbL), &copy; OpenMapTiles; map engine
- MapLibre Native (BSD-2-Clause), OpenFreeMap; Mapbox Maps SDK (Mapbox terms) when selected.<br/><br/>
+ MapLibre Native (BSD-2-Clause), OpenFreeMap${if (MapEngine.mapboxAvailable) "; Mapbox Maps SDK (Mapbox terms) when selected" else ""}.<br/><br/>
<b>What a match means</b><br/>
A device with that vendor or payload signature is broadcasting nearby. It is not
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapEngine.kt b/app/src/main/java/com/rfsentinel/app/ui/MapEngine.kt
index 823dfe9..f263017 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/MapEngine.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/MapEngine.kt
@@ -114,13 +114,14 @@ internal interface MapEngine {
fun placeBranding(topPx: Int, atEnd: Boolean = false)
companion object {
- val mapboxAvailable get() = BuildConfig.MAPBOX_TOKEN.isNotEmpty()
+ /** Mapbox needs the full build (the FOSS build leaves its SDK out) and a token in local.properties. */
+ val mapboxAvailable get() = MapboxSupport.INCLUDED && BuildConfig.MAPBOX_TOKEN.isNotEmpty()
fun chosen(context: Context): Provider =
Provider.parse(Prefs.mapProvider(context)).takeIf { it != Provider.MAPBOX || mapboxAvailable } ?: Provider.OPENFREEMAP
fun create(context: Context, provider: Provider = chosen(context)): MapEngine = when (provider) {
- Provider.MAPBOX -> MapboxEngine(context)
+ Provider.MAPBOX -> MapboxSupport.engine(context)
Provider.OPENFREEMAP -> MapLibreEngine(context)
}
}