public sealed class MobileLifecycleThe application lifecycle as a phone actually has one: foreground, background, and being killed without ceremony.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Shared, because the two platforms differ in vocabulary and not in shape. iOS says willResignActive, didEnterBackground, willEnterForeground, didBecomeActive, didReceiveMemoryWarning; Android says onPause, onStop, onRestart, onResume, onTrimMemory. The states behind them are the same three and the transitions are the same, so the state machine is here and each platform is a translation of its own callbacks into EnterBackground, Suspend and the rest.
Every transition raises an event, and it is the same event on both. Doc 10 names lifecycle as the biggest source of bugs on Android specifically because the surface is destroyed and recreated underneath a running renderer. A subsystem that must react — the swapchain, the streaming manager — reacts to Suspending and Resumed, not to anything platform-shaped.
Quitting is a request the platform is entitled to ignore. There is no supported way for an iOS application to terminate itself, and an Android one that finishes its activity may be kept alive. RequestQuit therefore raises Quit so the frame loop stops, and leaves the process to the operating system — which is the honest behaviour rather than a call to Environment.Exit that Apple rejects applications for.
Fields and properties (3)
public ApplicationState StateWhere the application is now.
public MemoryPressure MemoryPressureHow much memory pressure the OS last reported.
public bool IsQuitRequestedWhether a quit has been requested and not yet cancelled.
Methods (8)
public MobileLifecycle(PlatformEventBuffer events)The application lifecycle as a phone actually has one: foreground, background, and being killed without ceremony.
public void EnterForeground()The application became the one the user is looking at.
public void EnterBackground()The application is still alive but no longer frontmost.
public void Suspend()The application is off screen and its surface may not survive.
public void ReportMemoryPressure(MemoryPressure pressure)The system is short of memory.
public void Stopping()The process is going away.
public void RequestQuit()Asks the application to quit.
public void CancelQuit()
Used by (1)
- MobileLifecycleTestsVixen.Platform.Tests