Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Implement Lifecycle

For more information about the metrics and dimensions that can be measured automatically by the mobile library after lifecycle is implemented, see Lifecycle Metrics in Android or Lifecycle in iOS.

iOS

Lifecycle metrics are automatically collected in iOS.

Android

In your Unity script, you set the application context for the Android SDK. Add the following code to the Awake() function of your FIRST scene:

void Awake()
 {
  ...
  ADBMobile.SetContext();
  ...
 }

To collect lifecycle metrics, add the following code to all of your scene scripts:

void OnEnable()
 {
  ...
  ADBMobile.CollectLifecycleData (); 
  ...
 }
 
 void OnDisable()
 {
  ...
  ADBMobile.PauseCollectingLifecycleData (); 
  ...
 }
  
 void OnApplicationPause(bool isPaused) 
 {
  ...
  if (isPaused) {
   ADBMobile.PauseCollectingLifecycleData (); 
  }  
  else {
   ADBMobile.CollectLifecycleData(); 
  }
  ...
 }