Native System Events

To be able to subscribe for a native IOS App events you need to enable App Events API.

  1. Open IOS Native Editor Settings.  Window -> Stan's Assets -> IOS Native -> Edit Settings
  2. Enable App Events API as showed on a screenshot bellow

 With the Native System Events API, you can subscribe to the iOS events listed bellow.

Available actions list:

event Action OnApplicationDidEnterBackground	 	= delegate {};
event Action OnApplicationDidBecomeActive 			= delegate {};
event Action OnApplicationDidReceiveMemoryWarning 	= delegate {};
event Action OnApplicationWillResignActive 			= delegate {};
event Action OnApplicationWillTerminate 			= delegate {};
event Action<Models.LaunchUrl> OnOpenURL 			= delegate {};
event Action<Models.UniversalLink> OnContinueUserActivity 	= delegate {};

Note: Before you can subscribe to the listed action you need to call subscribe method, in order to activate native listener.

SA.IOSNative.Core.AppController.Subscribe()

Using example:

using using SA.IOSNative.Core;
...

//--------------------------------------
// INITIALISE
//--------------------------------------

void Awake() {
    AppController.Subscribe();
    AppController.OnApplicationDidReceiveMemoryWarning += OnApplicationDidReceiveMemoryWarning;
    AppController.OnApplicationDidBecomeActive += HandleOnApplicationDidBecomeActive;
}

//--------------------------------------
// EVENTS
//--------------------------------------
	

private void OnApplicationDidBecomeActive() {
    // Called when application become active again. Optionally refresh the user interface, check for some data than probably was chenged wile application was paused
    Debug.Log ("Received  OnApplicationDidBecomeActive event");
}

private void OnApplicationDidReceiveMemoryWarning() {
    //Called application receives a memory warning from the system.
    Debug.Log ("Received  OnApplicationDidReceiveMemoryWarning event");
}