Install Adobe Experience Platform 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 empty sample app.
- Experience with Xcode.
Learning objectives
In this lesson, you will:
- Add the required SDKs to your project using the Swift Package Manager.
- 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:
{modal="regular"}
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.
The AEPCore
, AEPServices
, and AEPIdentity
extensions represent the foundation of the Adobe Experience Platform SDK - every app using the SDK must include them. These modules contain a common set of functionality and services which are required by all SDK extensions.
AEPCore
contains implementation of the Event Hub. The Event Hub is the mechanism used for delivering events between the app and the SDK. The Event Hub is also used for sharing data between extensions.AEPServices
provides several reusable implementations needed for platform support, including networking, disk access, and database management.AEPIdentity
implements the integration with Adobe Experience Platform Identity services.AEPSignal
represents the Adobe Experience Platform SDKs Signal extension that allows marketers to send a “signal” to their apps to send data to external destinations or to open URLs.AEPLifecycle
represents the Adobe Experience Platform SDKs Lifecycle extension that helps collect application lifecycle metrics such as application install or upgrade information, application launch and session information, device information, and any additional context data provided by the application developer.
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 though 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 and requires the
AEPCore
and AEPServices
extensions for event handling, as well as the AEPEdgeIdentity
extension for retrieving the identities, such as ECID.AEPEdgeIdentity
) enables handling of user identity data from a mobile application when using the Adobe Experience Platform SDK and the Edge Network extension.AEPConsent
) enables consent preferences collection from the mobile application when using the Adobe Experience Platform SDK and the Edge Network extension.AEPUserProfile
) is an extension to manage user profiles for the Adobe Experience Platform SDK.AEPPlaces
) allows you to track geolocation events as defined in the Adobe Places interface and in Adobe Data Collection Tag rules.AEPMessaging
) allows you to send push notification tokens and push notification click-through feedback to the Adobe Experience Platform.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.AEPAssurance
) to help you inspect, proof, simulate, and validate how you collect data or serve experiences in your mobile app. This extension enables your app for Assurance.Import extensions
In Xcode, navigate to Luma > Luma > AppDelegate and ensure the following imports are part of this source file.
// import AEP MobileSDK libraries
import AEPCore
import AEPServices
import AEPIdentity
import AEPSignal
import AEPLifecycle
import AEPEdge
import AEPEdgeIdentity
import AEPEdgeConsent
import AEPUserProfile
import AEPPlaces
import AEPMessaging
import AEPOptimize
import AEPAssurance
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
to the Development 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.
MobileCore.configureWith(appId: self.environmentFileId)
with the appId
based on the environmentFileId
from the tag environment you are building for (development, staging, or production).Next: Set up Assurance