Expand my Community achievements bar.

SOLVED

Track crashes in Adobe Analytics

Avatar

Level 1

I compared iOS sdk with Android sdk and noticed that in iOS sdk isn't provided the ability to send additional context data with application lifecycle.
In Android sdk clearly stated that: To send additional context data with your lifecycle call by using Config.collectLifecycleData(Activity activity, Map<String, Object> contextData), you must override the onResume method for that Activity and ensure that you call super.onResume() after manually calling collectLifecycleData.

Is it possible for iOS?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Core Implementation and Lifecycle

Include Additional Data with Lifecycle Calls

To include additional data with lifecycle metric calls, use collectLifecycleDataWithAdditionalData:

Important: Any data that is passed to the SDK through collectLifecycleDataWithAdditionalData: will be persisted in NSUserDefaults by the SDK. The SDK strips the values in the NSDictionary parameter that are not of the NSString or NSNumber types.

  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  2.    NSMutableDictionary *contextData = [NSMutableDictionary dictionary];

  3.    [contextData setObject:@"Game" forKey:@"myapp.category"];

  4.    [ADBMobile collectLifecycleDataWithAdditionalData:contextData];

  5.    return YES;

  6. }

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Core Implementation and Lifecycle

Include Additional Data with Lifecycle Calls

To include additional data with lifecycle metric calls, use collectLifecycleDataWithAdditionalData:

Important: Any data that is passed to the SDK through collectLifecycleDataWithAdditionalData: will be persisted in NSUserDefaults by the SDK. The SDK strips the values in the NSDictionary parameter that are not of the NSString or NSNumber types.

  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  2.    NSMutableDictionary *contextData = [NSMutableDictionary dictionary];

  3.    [contextData setObject:@"Game" forKey:@"myapp.category"];

  4.    [ADBMobile collectLifecycleDataWithAdditionalData:contextData];

  5.    return YES;

  6. }

Avatar

Level 10

Does the previous reply answer your question?

Avatar

Level 3

is that collectLifecycleDataWithAdditionalData supposed to pass the data on future lifecycle calls or just the first lifecycle call after the install?

For me additional context data set in only sent in the first install lifecycle call. is there any additional instructions we are missing here?

Avatar

Level 3

collectLifecycleDataWithAdditionalData can be used to pass additional data layer variables on all lifecycle calls including the first one after install and the subsequent ones in future.

For this functionality to work, you would need to follow the instructions in the below link and section “Include Additional Data with Lifecycle Calls

https://marketing.adobe.com/resources/help/en_US/mobile/ios/dev_qs.html

Along with this, you will need to add the same collectLifecycleDataWithAdditionalData code into iOS applicationWillEnterForeground method as well. This is the part that helps send the additional data layer variables on the subsequent lifecycle calls after the first one.