Enable the collection of Lifecycle data in the Application Delegate. - Adobe-Marketing-Cloud/aml-summit-lab GitHub Wiki
Objective
In this section, we will use the SummitMobileLab application and add code for the SDK to collectLifeCycleData.
Setup
-
In the "aml-summit-lab" you just downloaded, open SummitMobileLab.xcodeproj
-
Navigate to AppDelegate.m located within the SummitMobileLab folder in Xcode.
Implementation Steps
- Import the ADBMobile.h header file.
- Go to line #18.
- Uncomment the line "#import "ADBMobile.h" by deleting "//". It should look as follows:
#import "ADBMobile.h"
- Enable lifecycle metrics and enable debug logging
- Go to line #49 and delete "/*".
- Go to line #57 and delete "*/".
- It should look as follows:
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/* [push message] Register app for push notifications of sound/ badge/ alert type.
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationType types = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound;
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
}
[application registerForRemoteNotifications];
*/
// [in app message] Enable the collection of Lifecycle data.
// 1. turn debug logging on so we can see activity in the Xcode console
[ADBMobile setDebugLogging:YES];
// 2. collect lifecycle data with additional data reporting the year
[ADBMobile collectLifecycleDataWithAdditionalData:@{@"summit.year":@"2017"}];
// initialize our fake data for the app
[self loadDestinations];
[self loadTransportationModes];
return YES;
}
Next Steps
PREVIOUS: Homepage