Lifecycle API reference
This document lists information about the previous versions of the Adobe Experience Platform Mobile SDKs. Check out this page for latest versions and solution support of the Mobile SDKs.
extensionVersion
The extensionVersion()
API returns the version of the Lifecycle extension that is registered with the Mobile Core extension.
To get the version of the Lifecycle extension, use the following code sample:
Swift
Copied to your clipboardlet lifecycleExtensionVersion = ACPLifecycle.extensionVersion()
Objective-C
Copied to your clipboardNSString *lifecycleExtensionVersion = [ACPLifecycle extensionVersion];
JavaScript
Copied to your clipboardACPLifecycle.extensionVersion().then(lifecycleExtensionVersion => console.log("AdobeExperienceSDK: ACPLifecycle version: " + lifecycleExtensionVersion));
Dart
Copied to your clipboardString lifeycycleExtensionVersion = await FlutterACPLifecycle.extensionVersion;
Cordova
Copied to your clipboardACPLifecycle.extensionVersion(function(version) {console.log("ACPLifecycle version: " + version);}, function(error) {console.log(error);});
C#
Copied to your clipboardstring lifecycleVersion = ACPLifecycle.ExtensionVersion();
C#
Copied to your clipboardstring lifecycleVersion = ACPLifecycle.ExtensionVersion();
Swift
Copied to your clipboardlet lifecycleExtensionVersion = ACPLifecycle.extensionVersion()
Objective-C
Copied to your clipboardNSString *lifecycleExtensionVersion = [ACPLifecycle extensionVersion];
JavaScript
Copied to your clipboardACPLifecycle.extensionVersion().then(lifecycleExtensionVersion => console.log("AdobeExperienceSDK: ACPLifecycle version: " + lifecycleExtensionVersion));
Dart
Copied to your clipboardString lifeycycleExtensionVersion = await FlutterACPLifecycle.extensionVersion;
Cordova
Copied to your clipboardACPLifecycle.extensionVersion(function(version) {console.log("ACPLifecycle version: " + version);}, function(error) {console.log(error);});
C#
Copied to your clipboardstring lifecycleVersion = ACPLifecycle.ExtensionVersion();
C#
Copied to your clipboardstring lifecycleVersion = ACPLifecycle.ExtensionVersion();
lifecycleStart
Starts the collection of lifecycle data.
For Analytics use case: Use this API to start a new lifecycle session or resume a previously paused lifecycle session. If a previously paused session timed out, then a new session is created. If a current session is running, then calling this method does nothing.
Java
This method should be called from the Activity onResume method.
Syntax
Copied to your clipboardpublic static void lifecycleStart(final Map<String, String> additionalContextData);
Example
Copied to your clipboardMobileCore.lifecycleStart(null);
If you need to collect additional lifecycle data:
Copied to your clipboardcontextData.put("myapp.category", "Game");MobileCore.lifecycleStart(additionalContextData);
Swift
Copied to your clipboardACPCore.lifecycleStart(["state": "appResume"])
Objective-C
Syntax
Copied to your clipboard+ (void) lifecycleStart: (nullable NSDictionary<NSString*, NSString*>*) additionalContextData;
Example
Copied to your clipboard[ACPCore lifecycleStart:nil];
If you need to collect additional lifecycle data:
Copied to your clipboard[ACPCore lifecycleStart:@{@"state": @"appResume"}];
C#
When using Unity, the LifecycleStart
method call must be made from the OnApplicationPause
method.
Copied to your clipboardprivate void OnApplicationPause(bool pauseStatus){if (!pauseStatus){ACPCore.LifecyclePause();}else{var cdata = new Dictionary<string, string>();cdata.Add("launch.data", "added");ACPCore.LifecycleStart(cdata);}}
C#
iOS
When using iOS, the LifecycleStart
method call must be made from the OnActivated
method.
Copied to your clipboardpublic override void OnActivated(UIApplication uiApplication){base.OnActivated(uiApplication);ACPCore.LifecycleStart(null);}
Android
When using Android, the LifecycleStart
method call must be made from the OnResume
method.
Copied to your clipboardprotected override void OnResume(){base.OnResume();ACPCore.LifecycleStart(null);}
Java
This method should be called from the Activity onResume method.
Syntax
Copied to your clipboardpublic static void lifecycleStart(final Map<String, String> additionalContextData);
Example
Copied to your clipboardMobileCore.lifecycleStart(null);
If you need to collect additional lifecycle data:
Copied to your clipboardcontextData.put("myapp.category", "Game");MobileCore.lifecycleStart(additionalContextData);
Swift
Copied to your clipboardACPCore.lifecycleStart(["state": "appResume"])
Objective-C
Syntax
Copied to your clipboard+ (void) lifecycleStart: (nullable NSDictionary<NSString*, NSString*>*) additionalContextData;
Example
Copied to your clipboard[ACPCore lifecycleStart:nil];
If you need to collect additional lifecycle data:
Copied to your clipboard[ACPCore lifecycleStart:@{@"state": @"appResume"}];
JavaScript
When using React Native, starting to collect lifecycle data should be done in native code which is shown under the Android and iOS tabs.
Cordova
When using Cordova, the lifecycleStart
method call must be made in native code which is shown under the Android and iOS tabs.
C#
When using Unity, the LifecycleStart
method call must be made from the OnApplicationPause
method.
Copied to your clipboardprivate void OnApplicationPause(bool pauseStatus){if (!pauseStatus){ACPCore.LifecyclePause();}else{var cdata = new Dictionary<string, string>();cdata.Add("launch.data", "added");ACPCore.LifecycleStart(cdata);}}
C#
iOS
When using iOS, the LifecycleStart
method call must be made from the OnActivated
method.
Copied to your clipboardpublic override void OnActivated(UIApplication uiApplication){base.OnActivated(uiApplication);ACPCore.LifecycleStart(null);}
Android
When using Android, the LifecycleStart
method call must be made from the OnResume
method.
Copied to your clipboardprotected override void OnResume(){base.OnResume();ACPCore.LifecycleStart(null);}
lifecyclePause
Pauses the collection of lifecycle data.
For Analytics use case: Use this API to pause the collection of lifecycle data.
C#
When using Unity, the LifecyclePause
method call must be made from the OnApplicationPause
method.
Copied to your clipboardprivate void OnApplicationPause(bool pauseStatus){if (!pauseStatus){ACPCore.LifecyclePause();}else{var cdata = new Dictionary<string, string>();cdata.Add("launch.data", "added");ACPCore.LifecycleStart(cdata);}}
C#
iOS
When using iOS, the LifecyclePause
method call must be made from the OnResignActivation
method.
Copied to your clipboardpublic override void OnResignActivation(UIApplication uiApplication){base.OnResignActivation(uiApplication);ACPCore.LifecyclePause();}
Android
When using Android, the LifecyclePause
method call must be made from the OnPause
method.
Copied to your clipboardprotected override void OnPause(){base.OnPause();ACPCore.LifecyclePause();}
Java
Syntax
Copied to your clipboardpublic static void lifecyclePause()
Example
Copied to your clipboardMobileCore.lifecyclePause();
Swift
Copied to your clipboardACPCore.lifecyclePause()
Objective-C
Syntax
Copied to your clipboard+ (void) lifecyclePause;
Example
Copied to your clipboard[ACPCore lifecyclePause];
JavaScript
When using React Native, pausing the collection of lifecycle data should be done in native code which is shown under the Android and iOS (ACP 2.x) tabs.
Cordova
When using Cordova, the lifecyclePause
method call must be made in native code which is shown under the Android and iOS tabs.
C#
When using Unity, the LifecyclePause
method call must be made from the OnApplicationPause
method.
Copied to your clipboardprivate void OnApplicationPause(bool pauseStatus){if (!pauseStatus){ACPCore.LifecyclePause();}else{var cdata = new Dictionary<string, string>();cdata.Add("launch.data", "added");ACPCore.LifecycleStart(cdata);}}
C#
iOS
When using iOS, the LifecyclePause
method call must be made from the OnResignActivation
method.
Copied to your clipboardpublic override void OnResignActivation(UIApplication uiApplication){base.OnResignActivation(uiApplication);ACPCore.LifecyclePause();}
Android
When using Android, the LifecyclePause
method call must be made from the OnPause
method.
Copied to your clipboardprotected override void OnPause(){base.OnPause();ACPCore.LifecyclePause();}