Reputation: 36
I'm working on an Flutter App. I added Android Auto functionality. The problem is that when the app is not running, Android Auto is also not working properly. That is because the functionality works with Method Channels to reuse my flutter code. Is there any way to launch the App/Flutter Engine from Android Auto? I don't care if it's a separate engine or the same the App uses. I also don't need the view to be launched.
val group = FlutterEngineGroup(
carContext,
arrayOf("-initWithName:project:allowHeadlessExecution:")
)
val flutterEngine = group.createAndRunDefaultEngine(carContext)
flutterEngine.dartExecutor.executeDartEntrypoint(DartEntrypoint.createDefault())
FlutterEngineCache
.getInstance()
.put("1", flutterEngine)
carContext.startActivity(
FlutterActivity.withCachedEngine("1").backgroundMode(
FlutterActivityLaunchConfigs.BackgroundMode.transparent
).build(carContext)
)
When using this code as example I'm not getting any logs from my main.dart
Upvotes: 1
Views: 244