Install Adobe Experience Platform Mobile SDKs tutorial_install_mobile_sdks
Learn how to implement the Adobe Experience Platform Mobile SDK in a mobile app.
Prerequisites
- Successfully built a tag library with the extensions described in the previous lesson.
- Development Environment File ID from the Mobile Install Instructions.
- Downloaded the sample app for iOS or sample app for Android.
- Experience with Xcode (iOS) or Android Studio (Android)
Learning objectives
In this lesson, you will:
- Add the required SDKs to your project.
- Register the extensions.
Swift Package Manager
Instead of using CocoaPods and a Pod file (as outlined in Generate SDK install instructions), you add individual packages using Xcode’s native Swift Package Manager. The Xcode project already has all packages dependencies added for you. The Xcode Package Dependencies screen should look like:
In Xcode, you can use File > Add Packages… to add packages. The table below provides links to the URLs you would use to add packages. The links also direct you to more information about each specific package.
table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 | |
---|---|
Package | Description |
AEP Core |
The
|
AEP Edge | The Adobe Experience Platform Edge Network mobile extension (AEPEdge ) allows you to send data to the Adobe Edge Network from a mobile application. This extension allows you to implement Adobe Experience Cloud capabilities in a more robust way, serve multiple Adobe solutions through one network call, and simultaneously forward this information to the Adobe Experience Platform.The Edge Network mobile extension is an extension for the Adobe Experience Platform SDK. The extension requires the AEPCore and AEPServices extensions for event handling, as well as the AEPEdgeIdentity extension for retrieving the identities, such as ECID. |
AEP Edge Identity | The Adobe Experience Platform Edge Identity mobile extension (AEPEdgeIdentity ) enables handling of user identity data from a mobile application when using the Adobe Experience Platform SDK and the Edge Network extension. |
AEP Edge Consent | The Adobe Experience Platform Consent Collection mobile extension (AEPConsent ) enables consent preferences collection from the mobile application when using the Adobe Experience Platform SDK and the Edge Network extension. |
AEP User Profile | The Adobe Experience Platform User Profile Mobile extension (AEPUserProfile ) is an extension to manage user profiles for the Adobe Experience Platform SDK. |
AEP Places | The Adobe Experience Platform Places extension (AEPPlaces ) allows you to track geolocation events as defined in the Adobe Places interface and in Adobe Data Collection Tag rules. |
AEP Messaging | The Adobe Experience Platform Messaging extension (AEPMessaging ) allows you to send push notification tokens and push notification click-through feedback to the Adobe Experience Platform. |
AEP Optimize | The Adobe Experience Platform Optimize extension (AEPOptimize ) provides APIs to enable real-time personalization workflows in the Adobe Experience Platform Mobile SDKs using Adobe Target or Adobe Journey Optimizer Offer Decisioning. It requires AEPCore and AEPEdge extensions to send personalization query events to the Experience Edge Network. |
AEP Assurance | Adobe Experience Platform Assurance is a product from Adobe Experience Cloud to help you inspect, proof, simulate, and validate how you collect data or serve experiences in your mobile app. |
Import extensions
Open in Xcode the project in the Start folder of the sample app.
In Xcode, navigate to Luma > Luma > AppDelegate and ensure that the following imports are part of this source file.
code language-swift |
---|
|
Do the same for Luma > Luma > Utils > MobileSDK.
Update AppDelegate
Navigate to Luma > Luma > AppDelegate in the Xcode Project navigator.
-
Replace the
@AppStorage
valueYOUR_ENVIRONMENT_ID_GOES_HERE
forenvironmentFileId
with the Environment File ID value that you retrieved from tags in Generate SDK install instructions.code language-swift @AppStorage("environmentFileId") private var environmentFileId = "YOUR_ENVIRONMENT_ID_GOES_HERE"
-
Add the following code to the
application(_, didFinishLaunchingWithOptions)
function.code language-swift // Define extensions let extensions = [ AEPIdentity.Identity.self, Lifecycle.self, Signal.self, Edge.self, AEPEdgeIdentity.Identity.self, Consent.self, UserProfile.self, Places.self, Messaging.self, Optimize.self, Assurance.self ] // Register extensions MobileCore.registerExtensions(extensions, { // Use the environment file id assigned to this application via Adobe Experience Platform Data Collection Logger.aepMobileSDK.info("Luma - using mobile config: \(self.environmentFileId)") MobileCore.configureWith(appId: self.environmentFileId) // set this to false or comment it when deploying to TestFlight (default is false), // set this to true when testing on your device. MobileCore.updateConfigurationWith(configDict: ["messaging.useSandbox": true]) if appState != .background { // only start lifecycle if the application is not in the background MobileCore.lifecycleStart(additionalContextData: nil) } // assume unknown, adapt to your needs. MobileCore.setPrivacyStatus(.unknown) })
The above code does the following:
- Registers the required extensions.
- Configures MobileCore and other extensions to use your tag property configuration.
- Enables debug logging. More details and options can be found in the Adobe Experience Platform Mobile SDK documentation.
- Starts lifecycle monitoring. See Lifecycle step in the tutorial for more details.
- Sets the default consent to unknown. See Consent step in the tutorial for more details.
Ensure you update MobileCore.configureWith(appId: self.environmentFileId)
with the appId
based on the environmentFileId
from the tag environment you are building for (development, staging, or production).
Gradle
You use the dependencies from the Generate SDK install instructions to add individual packages using Gradle’s integration with Android Studio, The Android Studio project already has all packages dependencies added for you.
-
Select
-
Select Android view.
-
Select Gradle scripts > build.gradle.kts (Module :app) from the left pane. Then, in the right pane, scroll until you see
dependencies
.
In Android Studio, you can use File > Project Structure… to add module dependencies. Select Dependencies and then use Modules
table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 5-row-2 6-row-2 7-row-2 8-row-2 9-row-2 | |
---|---|
Package com.adobe. marketing.mobile: |
Description |
core |
The
|
edge | The Adobe Experience Platform Edge Network mobile extension (AEPEdge ) allows you to send data to the Adobe Edge Network from a mobile application. This extension allows you to implement Adobe Experience Cloud capabilities in a more robust way, serve multiple Adobe solutions through one network call, and simultaneously forward this information to the Adobe Experience Platform.The Edge Network mobile extension is an extension for the Adobe Experience Platform SDK. The extension requires the Mobile Core and Services extensions for event handling. And the Identity for Edge Network extension for retrieving the identities, such as ECID. |
edgeidentity | The Adobe Experience Platform Edge Identity mobile extension enables handling of user identity data from a mobile application when using the Adobe Experience Platform SDK and the Edge Network extension. |
edgeconsent | The Adobe Experience Platform Consent Collection mobile extension enables consent preferences collection from the mobile application when using the Adobe Experience Platform SDK and the Edge Network extension. |
userprofile | The Adobe Experience Platform User Profile Mobile extension is an extension to manage user profiles for the Adobe Experience Platform SDK. |
aepplaces | Adobe Places Service is a geo-location service that enables mobile apps with location awareness. And to understand the location context by using rich and easy-to-use SDK interfaces accompanied by a flexible database of points of interests (POIs). For more information, see the Places Service Documentation. This service is the Places mobile extension for the Android 2.x Adobe Experience Platform SDK and requires the Core extension for event handling. |
messaging | The Adobe Experience Platform Messaging extension powers push notifications, in-app messages, and code-based experiences for your mobile apps. This extension also helps you to collect user push tokens and manages interaction measurement with Adobe Experience Platform services. |
optimize | The Adobe Experience Platform Optimize extension provides APIs to enable real-time personalization workflows in the Adobe Experience Platform SDKs using Adobe Target or Adobe Journey Optimizer Offer Decisioning. It depends on the Mobile Core and requires Edge Extension to send personalization query events to the Experience Edge Network. |
assurance | Assurance (a.k.a. project Griffon) is a mobile extension for Adobe Experience Platform that allows integrating with Adobe Experience Platform Assurance. The extension helps to inspect, proof, simulate, and validate how you collect data or serve experiences in your mobile app. This extension requires MobileCore. |
Import extensions
In Android Studio, navigate to app > kotlin+java > com.adobe.luma.tutorial.android > LumaApplication and ensure that the following imports are part of the source file.
code language-kotlin |
---|
|
Do the same for app > kotlin+java > com.adobe.luma.tutorial.android > models > MobileSDK.
Update LumaApplication
In the Android view, navigate to app > kotlin+java > com.adobe.luma.tutorial.android > LumaApplication in Android Studio.
-
Replace
"YOUR_ENVIRONMENT_FILE_ID"
inprivate var environmentFileId = "YOUR_ENVIRONMENT_ID_GOES_HERE"
with the Environment File ID value that you retrieved from tags in Generate SDK install instructions.code language-kotlin private var environmentFileId = "YOUR_ENVIRONMENT_ID_GOES_HERE"
-
Add the following code to
override fun onCreate()
function inclass LumaApplication : Application()
.code language-kotlin // Define extensions val extensions = listOf( Identity.EXTENSION, Lifecycle.EXTENSION, Signal.EXTENSION, Edge.EXTENSION, Consent.EXTENSION, UserProfile.EXTENSION, Places.EXTENSION, Messaging.EXTENSION, Optimize.EXTENSION, Assurance.EXTENSION ) // Register extensions MobileCore.registerExtensions(extensions) { // Use the environment file id assigned to this application via Adobe Experience Platform Data Collection Log.i("Luma", "Using mobile config: $environmentFileId") MobileCore.configureWithAppID(environmentFileId) // set this to true when testing on your device, default is false. //MobileCore.updateConfiguration(mapOf("messaging.useSandbox" to true)) // assume unknown, adapt to your needs. MobileCore.setPrivacyStatus(MobilePrivacyStatus.UNKNOWN) }
The above code does the following:
- Registers the required extensions.
- Configures MobileCore and other extensions to use your tag property configuration.
- Enables debug logging. More details and options can be found in the Adobe Experience Platform Mobile SDK documentation.
- Starts lifecycle monitoring. See Lifecycle step in the tutorial for more details.
- Sets the default consent to unknown. See Consent step in the tutorial for more details.
Ensure you update MobileCore.configureWith(environmentFileId)
with the environmentFileId
based on the Environment File ID from the tag environment you are building for (development, staging, or production).
Next: Set up Assurance