2017-01-09 28 views

回答

4

我understaning是,這是可能的對WidgetsBindingObserver的didChangeAppLifecycleState回調: https://docs.flutter.io/flutter/widgets/WidgetsBindingObserver-class.html

例子: https://github.com/flutter/flutter/search?utf8=%E2%9C%93&q=didChangeAppLifecycleState

我們一定要在這裏一些更好的文檔和示例。我已提出: https://github.com/flutter/flutter/issues/7394

如果這些都爲你的需求還不夠,還可以監聽你的Objective-C或Java代碼的任何事件,並通過HostMessages一起轉發到達特那些(在https://flutter.io/platform-services記錄) 。

+0

問題是,當Android上的活動停止時(即Dart VM隔離被破壞),目前沒有事件發送。 [AppLifecycleState](https://docs.flutter.io/flutter/dart-ui/AppLifecycleState-class.html)只有一個_paused_事件,沒有_destroyed_。見http://stackoverflow.com/questions/41924890/how-do-i-run-code-in-the-background-even-with-the-screen-off/42041981 –

相關問題