Make Android Auto an opt-in build flag
Android Auto support is now merged into the app only when building with -PandroidAuto=true (flutter build apk --android-project-arg=androidAuto=true). The car application meta-data and automotive_app_desc.xml move to android/app/src/androidAuto/, so default builds no longer declare Android Auto. Notification replies from the shade and watches are unchanged.
This commit is contained in:
1 parent
caee4d5c19
commit
fe7e72a421
6 files changed
+38
-7
No files matched your search
@@ -98,6 +98,24 @@ android {
|
||||
// }
|
||||
}
|
||||
|
||||
// Android Auto (notification read-aloud and voice reply) is opt-in, because
|
||||
// declaring it puts the app through Play's separate Android Auto review.
|
||||
// Enable it with `flutter build apk --android-project-arg=androidAuto=true`
|
||||
// or `./gradlew -PandroidAuto=true ...`.
|
||||
val androidAutoEnabled = (findProperty("androidAuto") as String?)?.toBoolean() == true
|
||||
|
||||
if (androidAutoEnabled) {
|
||||
android.sourceSets.getByName("main").res.srcDir("src/androidAuto/res")
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { variant ->
|
||||
if (androidAutoEnabled) {
|
||||
variant.sources.manifests.addStaticManifestFile("src/androidAuto/AndroidManifest.xml")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user