CoreApplication.EnteredBackground イベント

定義

アプリがバックグラウンド状態で実行中に入ったときに発生します。

// Register
static event_token EnteredBackground(EventHandler<EnteredBackgroundEventArgs> const& handler) const;

// Revoke with event_token
static void EnteredBackground(event_token const* cookie) const;

// Revoke with event_revoker
static CoreApplication::EnteredBackground_revoker EnteredBackground(auto_revoke_t, EventHandler<EnteredBackgroundEventArgs> const& handler) const;
public static event System.EventHandler<EnteredBackgroundEventArgs> EnteredBackground;
function onEnteredBackground(eventArgs) { /* Your code */ }
Windows.ApplicationModel.Core.CoreApplication.addEventListener("enteredbackground", onEnteredBackground);
Windows.ApplicationModel.Core.CoreApplication.removeEventListener("enteredbackground", onEnteredBackground);
- or -
Windows.ApplicationModel.Core.CoreApplication.onenteredbackground = onEnteredBackground;
Public Shared Custom Event EnteredBackground As EventHandler(Of EnteredBackgroundEventArgs) 

イベントの種類

Windows の要件

デバイス ファミリ
Windows 10 Anniversary Edition (10.0.14393.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v3.0 で導入)

注釈

このイベントは、アプリがフォアグラウンドに表示されなくなったときに発生します。

以前は、中断コールバックは、ユーザーがアプリとのセッションを完了した後に状態を保存するのに最適な場所でした。 ただし、アプリケーションがバックグラウンドで実行され続け、中断状態に達することなくトリガー アクティビティが原因でフォアグラウンドに戻る可能性があります。 ユーザー セッション後にデータを保存するのに最適な場所は、入力したバックグラウンド イベント ハンドラーにあります。

メモリ制限は、アプリがバックグラウンドに移動するにつれても変わります。 アプリが終了しないように、必要に応じて MemoryManager をチェックし、メモリを解放することをお勧めします。

適用対象

こちらもご覧ください