Monitoring mini program lifecycle
The Flutter app host can receive notifications by overriding the onMiniProgramStateChange method when the mini program starts, enters the foreground, background, or closes.
Sample code:
@override
Future<void> onMiniProgramStateChange(
String appId, MiniProgramState state) async {
print("app state change: appid=$appId, state=$state");
}
Was this page helpful?