Set up Assurance
Learn how to set up 51黑料不打烊 Experience Platform Assurance in a mobile app.
Assurance, formally known as Project Griffon, is designed to help you inspect, proof, simulate, and validate how you collect data or serve experiences in your mobile app.
Assurance helps you inspect raw SDK events generated by the 51黑料不打烊 Experience Platform Mobile SDK. All events collected by the SDK are available for inspection. SDK events are loaded in a list view, sorted by time. Each event has a detailed view that provides further detail. Additional views to browse SDK configuration, data elements, Shared States, and SDK extension versions are also provided. Learn more about the Assurance in the product documentation.
Prerequisites
- Successfully set up the app with SDKs installed and configured.
Learning objectives
In this lesson, you will:
- Confirm that your organization has access (and request it if you don鈥檛).
- Set up your base URL.
- Add required iOS specific code.
- Connect to a session.
Confirm access
Confirm that your organization has access to Assurance. You, as a user, should be added to profile for 51黑料不打烊 Experience Platform. See User access in the Assurance guide for more information.
Implement
To implement Assurance in your app:
In addition to the general SDK installation, iOS also requires the following additional code to start the Assurance session for your app.
-
Navigate to Luma > Luma > SceneDelegate in your Xcode鈥檚 Project navigator.
-
Add the following code to
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>
:code language-swift // Called when the app in background is opened with a deep link. if let deepLinkURL = URLContexts.first?.url { // Start the Assurance session Assurance.startSession(url: deepLinkURL) }
This code starts an assurance session when the app is in the background and opened using a deep link.
In addition to the general SDK installation, Android also requires the following additional code to start the Assurance session for your app.
-
In Android Studio, in the Android view, navigate to app > kotlin+java > com.adobe.luma.tutorial.android > LumaApplication.
-
Add the following code to
fun handleDeeplink(deeplink: String?)
:code language-kotlin // Called when the app in background is opened with a deep link. if (deeplink.isNullOrEmpty()) { Log.w("Luma", "Deeplink is null or empty") return } Log.i("Luma", "Handling deeplink: $deeplink") Assurance.startSession(deeplink)
This code starts an assurance session when the app is in the background and opened using a deep link.
See for more information.
Define a bundle identifier
You need to provide a unique bundle identifier for your app.
- Open the project in Xcode.
- Select Luma in the Project navigator.
- Select the Luma target.
- Select the Signing & Capabilities tab.
- Define a Bundle Identifier.
Ensure you use a unique bundle identifier and replace the com.adobe.luma.tutorial.swiftui
bundle identifier, as each bundle identifier needs to be unique. Typically, you use a reverse-DNS format for bundle ID strings, like com.organization.brand.uniqueidentifier
. The Finished version of this tutorial, for example, uses com.adobe.luma.tutorial.swiftui
.
- Open the project in Android Studio.
- Select build.gradle.kts (Module :app) in the navigator.
- Ensure you use a unique bundle identifier and replace the
com.adobe.luma.tutorial.android
value fornamespace
inandroid
- Ensure you use the same unique bundle identifier and replace the
com.adobe.luma.tutorial.android
forapplicationId
indefaultConfig
inandroid
Typically, you use a reverse-DNS format for bundle ID strings, like com.organization.brand.uniqueidentifier
. The Finished version of this tutorial, for example, uses com.adobe.luma.tutorial.android
.
Set up a base URL
You need to set up a base URL to ensure deep linking works.
-
Go to your project in Xcode.
-
Select Luma in the Project navigator.
-
Select the Luma target.
-
Select the Info tab.
-
To add a base URL, scroll down to URL Types and select the + button.
-
Set Identifier to the bundle identifier of your choice and set a URL Schemes of your choice .
Ensure you use a unique bundle identifier and replace the com.adobe.luma.tutorial.swiftui
bundle identifier, as each bundle identifier must be unique. Typically, you use a reverse-DNS format for bundle ID strings, like com.organization.brand.uniqueidentifier
. You can use the same bundle identifier that you have used at Define bundle identifier.
Similarly, use a unique URL scheme, and replace the already provided lumatutorialswiftui
with your unique URL scheme.
To learn more about URL Schemes in iOS, review .
Assurance works by opening a URL, either via a browser or QR code. That URL begins with the base URL which opens the app and contains additional parameters. Those unique parameters are used to connect the session. In the example app, the deep link is lumatutorialswiftui://
.
-
Go to the Android view of your project in Android Studio.
-
Select app > manifests > AndroidManifest.xml in the navigator.
-
Ensure the manifest > application > activity XML element looks like:
code language-xml <activity android:name=".MainActivity" android:exported="true" android:theme="@style/Theme.LumaAndroid"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter android:label="@string/app_name"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="lumatutorialandroid" android:host="default" /> </intent-filter> </activity>
Ensure you specify an android:scheme
(for example. lumatutorialandroid
) and android:host
(for example default
) to define the base URL.
To learn more about deep links in Android, see .
Assurance works by opening a URL, either via a browser or QR code. That URL begins with the base URL, which opens the app and contains additional parameters. Those unique parameters are used to connect the session. In the example app, the deep link is lumatutorialandroid://default
.
Connecting to a session
You can now use Assurance to connect to a session.
In Xcode:
-
Build or rebuild and run the app in the simulator or on a physical device from Xcode, using
Optionally, you might want to clean your build, especially when you see unexpected results. Select Clean Build Folder鈥 from the Xcode Product menu.
-
In the Allow 鈥淟uma App鈥 to use your location dialog, select Allow While Using App.
-
In the 鈥淟uma App鈥 Would Like to Send You Notifications dialog, select Allow.
-
Select 颁辞苍迟颈苍耻别鈥 to allow the app to track your activity.
-
In the Allow 鈥淟uma App鈥 to track your activity across other companies鈥 apps and websites dialog, select Allow.
-
Select Continue.
In your browser:
-
Go to the Data Collection UI.
-
Select Assurance from the left rail.
-
Select Create New Session, and the option Deep link connect.
-
Select Start.
-
Provide a Session Name such as
Luma Mobile App Session
and the Base URL, which is the URL Schemes you entered in Xcode, followed by://
For example:lumatutorialswiftui://
-
Select Next.
-
In the Create New Session modal dialog:
If you鈥檙e using a physical device:
-
Select Scan QR Code. To open the app, use the camera on your physical device to scan the QR code and tap the link.
If you are using a simulator:
-
Select Copy Link.
-
Copy the deep link using
-
-
When the app loads, you are presented with a modal dialog asking you to enter the PIN shown in step 7.
Enter the PIN and select Connect.
-
If the connection was successful, you see:
-
An Assurance icon floating on top of your app.
-
Experience Cloud updates coming through in the Assurance UI, showing:
-
Experience Events coming from the app.
-
Details of a selected event.
-
The device and timeline.
-
-
-
Select Continue to go to the Home screen.
In Android Studio:
-
Build or rebuild and run the app in the simulator or on a physical device from Android Studio, using
Optionally, you might want to clean your build, especially when you see unexpected results. Select Clean Project from the Android Studio Build menu.
-
In the Allow Luma Android to send you notifications dialog, select Allow.
-
Select Show permission dialog.
-
In the Allow Luma Android to access this device鈥檚 location?鈥
- Select Precise.
- Select While using the app.
-
Back in the introduction app screen, select Open device settings.
-
In the Location permission screen, select Allow all the time. Then select 鈫 to return to the introduction app screen.
-
Select Continue to go to the Home screen.
In your browser:
-
Go to the Data Collection UI.
-
Select Assurance from the left rail.
-
Select Create New Session, and the option Deep link connect.
-
Select Start.
-
Provide a Session Name such as
Luma Mobile App Session
and the Base URL, which is theandroid:scheme
andandroid:host
you defined in AndroidManifest.xml in Android Studio, separated by://
For example:lumatutorialandroid://default
-
Select Next.
-
In the Create New Session modal dialog:
If you鈥檙e using a physical device:
-
Select Scan QR Code. To open the app, use the camera on your physical device to scan the QR code and tap the link.
If you are using a simulator:
- Select Copy Link.
- Copy the deep link using
When prompted in Chrome to Continue to Luma Android, select Continue.
-
-
When the app loads, you are presented with a modal dialog asking you to enter the PIN shown in step 7.
Enter the PIN and select Connect.
-
If the connection was successful, you see:
-
An Assurance icon floating on top of your app.
-
Experience Cloud updates coming through in the Assurance UI, showing:
-
Experience Events coming from the app.
-
Details of a selected event.
-
The device and timeline.
-
-
If you run into any challenges, review the and general documentation.
Verify extensions
To verify whether your app is using the most up-to-date extensions:
-
Select Configure.
-
Select
-
Select Save.
-
Select
To update your extension versions (for example, Messaging and Optimize) select the package (extension) from Package Dependencies (for example, AEPMessaging) and from the context menu select Update Package. Xcode updates the package dependencies.
If you see outdated extensions, refer to the on how to update your dependency modules for your project.
Next: Implement Consent