Android Flutter launch custom activity with cached engine
614
In your CustomFlutterActivity
which I suppose is derived from FlutterActivity
you can override getCachedEngineId
and provide the my_engine_id
you have previously cached according to the docs, namely:
FlutterEngineCache
.getInstance()
.put("my_engine_id", flutterEngine);
Thus:
class CustomFlutterActivity: FlutterActivity() {
override fun getCachedEngineId(): String? {
return "my_engine_id"
}
}
See docs
Comments
-
user3703910 over 1 year
Iam integrating
FlutterActivity
to a native Android app. I haveCustomFlutterActivity
which inherits fromFlutterActivity
, which I want to launch using cachedFlutterEngine
.This is the code from the documentation for how to do this:
startActivity( FlutterActivity .withNewEngine() .build(currentActivity) );
What I want to achieve is to launch my
CustomFlutterActivity
with my cached engine (and not a genericFlutterActivity
as the documentation says)