diff --git a/README.md b/README.md index 6aa7f1877..033d29cad 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ You can generate the documentation locally to preview your changes. You can help translate the app into your native language using [Crowdin](https://crowdin.meshtastic.org/android). ## Building the Android App +> [!WARNING] +> Debug and release builds can be installed concurrently. This is solely to enable smoother development, and you should avoid running both apps simultaneously. To ensure proper function, force quit the app not in use. https://meshtastic.org/docs/development/android/ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ff3d42b99..a89b6c4be 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -173,16 +173,15 @@ secrets { // workaround for https://github.com/google/ksp/issues/1590 androidComponents { - /** Disabling until this works w/ bluetooth */ - // onVariants(selector().all()) { variant -> - // if (variant.name == "fdroidDebug") { - // variant.applicationId = "com.geeksville.mesh.fdroid.debug" - // } - // - // if (variant.name == "googleDebug") { - // variant.applicationId = "com.geeksville.mesh.google.debug" - // } - // } + onVariants(selector().all()) { variant -> + if (variant.name == "fdroidDebug") { + variant.applicationId = "com.geeksville.mesh.fdroid.debug" + } + + if (variant.name == "googleDebug") { + variant.applicationId = "com.geeksville.mesh.google.debug" + } + } onVariants(selector().withBuildType("release")) { variant -> if (variant.flavorName == "google") { val variantNameCapped = variant.name.replaceFirstChar { it.uppercase() } diff --git a/app/src/main/java/com/geeksville/mesh/MeshServiceClient.kt b/app/src/main/java/com/geeksville/mesh/MeshServiceClient.kt index f20aaf816..5654b3262 100644 --- a/app/src/main/java/com/geeksville/mesh/MeshServiceClient.kt +++ b/app/src/main/java/com/geeksville/mesh/MeshServiceClient.kt @@ -111,6 +111,6 @@ constructor( Timber.e("Failed to start service from activity - but ignoring because bind will work: ${ex.message}") } - connect(activity, MeshService.createIntent(), BIND_AUTO_CREATE + BIND_ABOVE_CLIENT) + connect(activity, MeshService.createIntent(activity), BIND_AUTO_CREATE + BIND_ABOVE_CLIENT) } } diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index 303aa613c..3614b558f 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -197,7 +197,7 @@ class MeshService : Service() { startService(context) } - fun createIntent() = Intent().setClassName("com.geeksville.mesh", "com.geeksville.mesh.service.MeshService") + fun createIntent(context: Context) = Intent(context, MeshService::class.java) /** * The minimum firmware version we know how to talk to. We'll still be able to talk to 2.0 firmwares but only diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshServiceStarter.kt b/app/src/main/java/com/geeksville/mesh/service/MeshServiceStarter.kt index 1e280ba5e..c868d2946 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshServiceStarter.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshServiceStarter.kt @@ -38,7 +38,7 @@ class ServiceStarter(appContext: Context, workerParams: WorkerParameters) : Work // Indicate whether the task finished successfully with the Result Result.success() } catch (ex: Exception) { - Timber.e("failure starting service, will retry", ex) + Timber.e(ex, "failure starting service, will retry") Result.retry() } } @@ -72,7 +72,7 @@ fun MeshService.Companion.startService(context: Context) { // to Signal or whatever. Timber.i("Trying to start service debug=${BuildConfig.DEBUG}") - val intent = createIntent() + val intent = createIntent(context) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { try { context.startForegroundService(intent)