@@ -61,24 +61,23 @@ import mParticle_Apple_SDK
6161
6262func application (_ application : UIApplication, didFinishLaunchingWithOptions launchOptions : [UIApplicationLaunchOptionsKey: Any ]? ) -> Bool {
6363
64- // Override point for customization after application launch.
64+ // override point for customization after application launch.
6565 let mParticleOptions = MParticleOptions (key : " <<<App Key Here>>>" , secret : " <<<App Secret Here>>>" )
6666
67- // Please see the Identity page for more information on building this object
67+ // optional- Please see the Identity page for more information on building this object
6868 let request = MPIdentityApiRequest ()
6969 request.
email = " [email protected] " 7070 mParticleOptions.identifyRequest = request
71+ // optional
7172 mParticleOptions.onIdentifyComplete = { (apiResult, error) in
7273 NSLog (" Identify complete. userId = %@ error = %@" , apiResult? .user .userId .stringValue ?? " Null User ID" , error? .localizedDescription ?? " No Error Available" )
7374 }
75+ // optional
7476 mParticleOptions.onAttributionComplete = { (attributionResult, error) in
7577 NSLog (@" Attribution Complete. attributionResults = %@" , attributionResult.linkInfo )
7678 }
77-
78- // Start the SDK
79- MParticle.sharedInstance ().start (with : mParticleOptions)
80-
81- return true
79+ MParticle.sharedInstance ().start (with : mParticleOptions)
80+ return true
8281}
8382```
8483
@@ -110,13 +109,15 @@ Next, you'll need to start the SDK:
110109 MParticleOptions *mParticleOptions = [MParticleOptions optionsWithKey:@"REPLACE ME"
111110 secret:@"REPLACE ME"];
112111
113- //Please see the Identity page for more information on building this object
112+ //optional - Please see the Identity page for more information on building this object
114113 MPIdentityApiRequest *request = [MPIdentityApiRequest requestWithEmptyUser];
115114 request.email = @"[email protected] "; 116115 mParticleOptions.identifyRequest = request;
116+ //optional
117117 mParticleOptions.onIdentifyComplete = ^(MPIdentityApiResult * _Nullable apiResult, NSError * _Nullable error) {
118118 NSLog(@"Identify complete. userId = %@ error = %@", apiResult.user.userId, error);
119119 };
120+ //optional
120121 mParticleOptions.onAttributionComplete(MPAttributionResult * _Nullable attributionResult, NSError * _Nullable error) {
121122 NSLog(@"Attribution Complete. attributionResults = %@", attributionResult.linkInfo)
122123 }
@@ -138,29 +139,31 @@ See [Identity](http://docs.mparticle.com/developers/sdk/ios/identity/) for more
138139
139140For more help, see [ the Android set up docs] ( https://docs.mparticle.com/developers/sdk/android/getting-started/#create-an-input ) .
140141
141- ``` java
142+ ``` kotlin
142143package com.example.myapp ;
143144
144145import android.app.Application;
145146import com.mparticle.MParticle;
146147
147- public class MyApplication extends Application {
148- @Override
149- public void onCreate () {
150- super . onCreate();
151- MParticleOptions options = MParticleOptions . builder(this )
152- .credentials(" REPLACE ME WITH KEY" ," REPLACE ME WITH SECRET" )
153- .setLogLevel(MParticle . LogLevel . VERBOSE )
148+ class MyApplication : Application () {
149+ fun onCreate () {
150+ super .onCreate()
151+ val options: MParticleOptions = MParticleOptions .builder(this )
152+ .credentials(" REPLACE ME WITH KEY" , " REPLACE ME WITH SECRET" )
153+ // optional
154+ .logLevel(MParticle .LogLevel .VERBOSE )
155+ // optional
154156 .identify(identifyRequest)
157+ // optional
155158 .identifyTask(
156- new BaseIdentityTask ()
157- .addFailureListener(this )
158- .addSuccessListener(this )
159- )
159+ BaseIdentityTask ()
160+ .addFailureListener { errorResponse -> }
161+ .addSuccessListener{ result -> }
162+ )
163+ // optional
160164 .attributionListener(this )
161- .build();
162-
163- MParticle . start(options);
165+ .build()
166+ MParticle .start(options)
164167 }
165168}
166169```
0 commit comments