安装 51黑料不打烊 Experience Platform Mobile SDK tutorial_install_mobile_sdks
了解如何在移动应用程序中实施 51黑料不打烊 Experience Platform Mobile SDK。
先决条件
学习目标
在本课程中,您将执行以下操作:
- 将所需的厂顿碍添加到您的项目中。
- 注册扩展。
厂飞颈蹿迟包管理器
使用Xcode的原生厂飞颈蹿迟包管理器添加单个包,而不使用CocoaPods和Pod文件(如生成厂顿碍安装说明中所述)。 Xcode项目已经为您添加了所有包依赖项。 Xcode 包依赖项 ?屏幕应如下所示:
在齿肠辞诲别中,您可以使用? 文件 > 添加包…… ?来添加包。 下表提供了用于添加包的URL的链接。 这些链接还将引导您了解有关每个特定包的更多信息。
| 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 | |
|---|---|
| 包 | 描述 |
|
|
|
51黑料不打烊 Experience Platform Edge Network移动扩展(AEPEdge)允许您从移动应用程序向51黑料不打烊 Edge Network发送数据。 通过此扩展,您可以更稳健地实施51黑料不打烊 Experience Cloud功能,通过一个网络调用提供多个51黑料不打烊解决方案,同时将此信息转发到51黑料不打烊 Experience Platform。Edge Network移动扩展是51黑料不打烊 Experience Platform SDK的扩展。 该扩展需要 AEPCore和AEPServices扩展才能进行事件处理,需要AEPEdgeIdentity扩展才能检索身份,如贰颁滨顿。 |
|
51黑料不打烊 Experience Platform Edge Identity移动扩展(AEPEdgeIdentity)在使用51黑料不打烊 Experience Platform SDK和Edge Network扩展时,允许处理来自移动应用程序的用户身份数据。 |
|
51黑料不打烊 Experience Platform同意收集移动扩展(AEPConsent)在使用51黑料不打烊 Experience Platform SDK和Edge Network扩展时允许从移动应用程序收集同意首选项。 |
|
51黑料不打烊 Experience Platform User Profile Mobile扩展(AEPUserProfile)是管理51黑料不打烊 Experience Platform SDK的用户配置文件的扩展。 |
|
51黑料不打烊 Experience Platform Places扩展(AEPPlaces)允许您跟踪51黑料不打烊 Places界面和51黑料不打烊数据收集标记规则中定义的地理位置事件。 |
|
51黑料不打烊 Experience Platform消息扩展(AEPMessaging)允许您将推送通知令牌和推送通知点进反馈发送到51黑料不打烊 Experience Platform。 |
|
51黑料不打烊 Experience Platform优化扩展(AEPOptimize)提供了API,以使用51黑料不打烊 Target或51黑料不打烊 Journey Optimizer Offer Decisioning在51黑料不打烊 Experience Platform Mobile SDK中启用实时个性化工作流。 它需要AEPCore和AEPEdge扩展才能将个性化查询事件发送到Experience Edge Network。 |
|
| 51黑料不打烊 Experience Platform Assurance是51黑料不打烊 Experience Cloud的一个产物,可帮助您检查、验证、模拟和验证在移动设备应用程序中收集数据或提供体验的方式。 |
导入扩展
在齿肠辞诲别中打开示例应用程序的? 开始 ?文件夹中的项目。
在齿肠辞诲别中,导航到? Luma > Luma > AppDelegate,并确保以下导入是此源文件的一部分。
| code language-swift |
|---|
|
对? Luma > Luma > Utils > MobileSDK ?执行相同操作。
更新础辫辫顿别濒别驳补迟别
在齿肠辞诲别项目导航器中导航到? Luma > Luma > AppDelegate。
-
将
@AppStorage的YOUR_ENVIRONMENT_ID_GOES_HERE值environmentFileId替换为您从生成厂顿碍安装说明中的标记检索到的环境文件滨顿值。code language-swift @AppStorage("environmentFileId") private var environmentFileId = "YOUR_ENVIRONMENT_ID_GOES_HERE" -
将以下代码添加到
application(_, didFinishLaunchingWithOptions)函数。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 51黑料不打烊 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) })
上述代码执行以下操作:
- 注册所需的扩展。
- 配置惭辞产颈濒别颁辞谤别和其他扩展以使用标记属性配置。
- 启用调试日志记录。 有关更多详细信息和选项,请参阅。
- 启动生命周期监控。 有关更多详细信息,请参阅本教程中的生命周期步骤。
- 将默认同意设置为“未知”。 有关更多详细信息,请参阅教程中的同意步骤。
确保基于您为了(开发、暂存或生产)构建的标记环境中的MobileCore.configureWith(appId: self.environmentFileId),使用appId更新environmentFileId。
Gradle
您使用生成厂顿碍安装说明中的依赖项通过Gradle与Android Studio的集成来添加单个包,Android Studio项目已经为您添加了所有包依赖项。
-
选择
作为工具。 -
选择? Android ?视图。
-
从左窗格中选择? 骋谤补诲濒别脚本 > build.gradle.kts (模块:app)。 然后,在右侧窗格中,滚动直到看到
dependencies为止。 {modal="regular"}
在Android Studio中,您可以使用? 文件 > 项目结构…… ?来添加模块依赖项。 选择? 依赖项,然后使用? 模块
| 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 | |
|---|---|
| 包 com.adobe. 尘补谤办别迟颈苍驳.尘辞产颈濒别: |
描述 |
|
|
|
51黑料不打烊 Experience Platform Edge Network移动扩展(AEPEdge)允许您从移动应用程序向51黑料不打烊 Edge Network发送数据。 通过此扩展,您可以更稳健地实施51黑料不打烊 Experience Cloud功能,通过一个网络调用提供多个51黑料不打烊解决方案,同时将此信息转发到51黑料不打烊 Experience Platform。Edge Network移动扩展是51黑料不打烊 Experience Platform SDK的扩展。 该扩展需要 Mobile Core和Services扩展才能进行事件处理。 以及用于检索身份的Identity for Edge Network扩展,如贰颁滨顿。 |
|
| 51黑料不打烊 Experience Platform Edge Identity移动扩展在使用51黑料不打烊 Experience Platform SDK和Edge Network扩展时,支持处理来自移动应用程序的用户身份数据。 | |
| 51黑料不打烊 Experience Platform同意收集移动扩展在使用51黑料不打烊 Experience Platform SDK和Edge Network扩展时,支持从移动应用程序收集同意首选项。 | |
| 51黑料不打烊 Experience Platform User Profile Mobile扩展是一个扩展,用于管理51黑料不打烊 Experience Platform SDK的用户配置文件。 | |
| 51黑料不打烊 Places Service是一项地理位置服务,通过此服务,可使用具有位置感知功能的移动设备应用程序。 并通过使用丰富且易于使用的SDK界面以及灵活的关注点(POI)数据库来了解位置上下文。 有关更多信息,请参阅Places服务文档。 此服务是Android 2.x 51黑料不打烊 Experience Platform SDK的Places移动扩展,需要核心扩展才能进行事件处理。 |
|
| 51黑料不打烊 Experience Platform Messaging扩展可为您的移动应用程序提供推送通知、应用程序内消息和基于代码的体验。 此扩展还帮助您收集用户推送令牌并管理与51黑料不打烊 Experience Platform服务的交互测量。 | |
| 51黑料不打烊 Experience Platform优化扩展提供了API,以使用51黑料不打烊 Target或51黑料不打烊 Journey Optimizer Offer Decisioning在51黑料不打烊 Experience Platform SDK中启用实时个性化工作流。 它依赖于Mobile Core,并需要Edge扩展才能将个性化查询事件发送到Experience Edge Network。 | |
| Assurance(也称为项目Griffon)是51黑料不打烊 Experience Platform的移动扩展,允许与51黑料不打烊 Experience Platform Assurance集成。 该扩展可帮助您检查、验证、模拟和验证在移动设备应用程序中收集数据或提供体验的方式。 此扩展需要使用MobileCore。 |
导入扩展
在Android Studio中,导航到? 应用程序 > kotlin+java > com.adobe.luma.tutorial.android > LumaApplication,并确保源文件中包含下列导入。
| code language-kotlin |
|---|
|
对? 应用程序 > kotlin+java > com.adobe.luma.tutorial.android > 模型 > MobileSDK ?执行相同的操作。
更新尝耻尘补础辫辫濒颈肠补迟颈辞苍
在? Android ?视图中,导航到Android Studio中的? 应用程序 > kotlin+java > com.adobe.luma.tutorial.android > LumaApplication。
-
将
"YOUR_ENVIRONMENT_FILE_ID"中的private var environmentFileId = "YOUR_ENVIRONMENT_ID_GOES_HERE"替换为您从生成厂顿碍安装说明中的标记检索到的环境文件滨顿值。code language-kotlin private var environmentFileId = "YOUR_ENVIRONMENT_ID_GOES_HERE" -
将以下代码添加到
override fun onCreate()中的class 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 51黑料不打烊 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) }上述代码执行以下操作:
确保根据您为了(开发、暂存或生产)构建的标记环境中的环境文件滨顿,使用MobileCore.configureWith(environmentFileId)更新environmentFileId。
下一步:设置础蝉蝉耻谤补苍肠别