Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Latest commit

 

History

History
41 lines (31 loc) · 861 Bytes

lifecycle.md

File metadata and controls

41 lines (31 loc) · 861 Bytes

Implement lifecycle

This information helps you implement Lifecycle metrics for Android.

Tip: Lifecycle metrics are automatically collected for iOS.

For the metrics and dimensions that can be measured automatically by the mobile library after lifecycle is implemented, see Lifecycle Metrics.

iOS

In iOS, lifecycle metrics are automatically collected.

Android

In your main activity, set the application context for the Android SDK.

protected override void OnCreate (Bundle bundle) 
{
    ... 
    Config.SetContext (Application.Context); 
    ... 
}

In every activity, implement lifecycle calls.

protected override void OnResume()
{
    ...
    Config.CollectLifecycleData (this);
    ...
}
protected override void OnPause() 
{
    ...
    Config.PauseCollectingLifecycleData ();
    ...
}