Skip to content

Commit a68bff9

Browse files
authored
[Android] 增加引擎释放接口 (alibaba#1291)
* [Android] 增加引擎释放接口 * 增加注释
1 parent 8f7f41d commit a68bff9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

android/src/main/java/com/idlefish/flutterboost/FlutterBoost.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ public void setup(Application application, FlutterBoostDelegate delegate, Callba
8383
setupActivityLifecycleCallback(application, isBackForegroundEventOverridden);
8484
}
8585

86+
/**
87+
* Releases the engine resource.
88+
*/
89+
public void tearDown() {
90+
FlutterEngine engine = getEngine();
91+
if (engine != null) {
92+
engine.destroy();
93+
FlutterEngineCache.getInstance().remove(ENGINE_ID);
94+
}
95+
topActivity = null;
96+
plugin = null;
97+
isBackForegroundEventOverridden = false;
98+
isAppInBackground = false;
99+
}
100+
86101
/**
87102
* Gets the FlutterBoostPlugin.
88103
*

0 commit comments

Comments
 (0)