Show Menu
主题×

Developer quick start

Here is some information about how to implement the Universal Windows Platform library.
要实施SDK,您需要Visual Studio 2013或更高版本。

获取 SDK

After you unzip the SDK download file, you will have a separate folder for each supported architecture and platform combination. 您还会有一个 ADBMobileConfig.json 文件。 有关此文件的详细信息,请参 阅ADBMobileConfig.json配置文件

Select the correct version

Different .dll/.winmd files are provided for each supported architecture (x86, x64, ARM).
The version of ADBMobile.winmd does not reflect the version of the library. 该文 .winmd 件仅包含元数据,并具有版本号, 255.255.255.255 根据Microsoft的规定,该版本号为可接受的行为。 有关详细信息,请 参阅如何为WinRT C++ / CX组件dll添加组件信息? 。To check the version of the library you are using, check the version of the underlying ADBMobile.dll file.

语法差异

通用 Windows 平台库可用于多种编程语言。本指南中的示例在WinJS(JavaScript)中,如果您使用的是其他语言,则可能需要修改。 当您使用winJS中的winmd方法时,所有方法都会自动将其第一个字母小写。
不同实施之间的主要差别在于上下文数据所使用的数据结构。Additionally, when using the SDK in a WinJS project, use an empty string ( "" or '' ) instead of null for empty string values.

Add the library and config File to your project - C#

  1. 启动 Visual Studio 并打开您的解决方案。
  2. In the Solution Explorer , right-click References and select Add Reference .
  3. Select the correct version of the library and browse to the associated ADBMobile.winmd file.
    有关详细信息,请参 阅在此页上选择正确的版 本部分。
  4. 单击​ 添加
  5. Verify that the ADBMobile.winmd file is checked in the Reference Manager window and click OK .
  6. In the Solution Explorer , right-click References and select Add Reference .
    如果您的解决方案中还包含C++项目,请跳过此步骤。
  7. 在左侧的 Windows 选项卡中,选择“扩展” ,选择并添加 Visual C++ 2015 Runtime for Universal Windows Platform Apps
  8. 将以下行添加到您的类中:
    using ADBMobile;
    
    
  9. Right-click your project and click Add > Existing Item .
  10. 浏览至文件 ADBMobileConfig.json 并单击“添 加”
  11. 右键单击解决方 ADBMobileConfig.json 案中的文件,然后选择 属性
  12. Change Build Action to Content .

Add the library and config file to your project - C++

  1. 启动 Visual Studio 并打开您的解决方案。
  2. In the Solution Explorer , right-click your project and select Add > References .
  3. 选择库的正确版本,并添加对关联的ADBMobile.winmd文件的引用。
    有关详细信息,请参 阅在此页上选择正确的版 本部分。
  4. Click Add .
  5. Verify that ADBMobile.winmd is checked in the Reference Manager window and click OK .
  6. 将以下行添加到您的类中:
    using namespace ADBMobile;
    
    
  7. Right-click your project and select Add > Existing Item .
  8. Browse to ADBMobileConfig.json file and click Add .
  9. Right-click the ADBMobileConfig.json file in your solution and select Properties .
  10. On the General tab, change Content to Yes and click OK .

Add the library and config file to your project - WinJS

  1. 启动 Visual Studio 并打开您的解决方案。
  2. In the Solution Explorer , right-click References and select Add Reference .
  3. Select the correct version of the library and browse to the associated ADBMobile.winmd file.
  4. Click Add .
  5. Verify that the ADBMobile.winmd file is checked in the Reference Manager window and click OK .
  6. In the Solution Explorer , right-click References and select Add Reference .
    如果您的解决方案中还包含C++项目,请跳过此步骤。
  7. 在左侧的 Windows 选项卡中,选择“扩展” ,然后选择并添加 Visual C++ 2015 Runtime for Universal Windows Platform Apps
  8. Right-click your project and select Add > Existing Item .
  9. 浏览至文件 ADBMobileConfig.json 并单击“添 加”
  10. Right-click the ADBMobileConfig.json file in your solution and select Properties .
  11. 选择“ 文件属性 ”后,确保将“ 包操作 ”设置为“ 内容”
    对于JavaScript项目,默认情况下将文件设置为“内容”。

Update The ADBMobileConfig.json config file

The ADBMobileConfig.json file contains global SDK settings and is located at your project root after you complete the steps in the Add the library and config file to your project section. If your ADBMobileConfig.json file was not pre-configured by Adobe Mobile Services, you need to update a few values to get started.
以下是 ADBMobileConfig.json 文件的示例:
{ 
    "version" : "1.0", 
    "analytics" : { 
        "rsids" : "coolApp", 
        "server" : "my.CoolApp.com", 
        "charset" : "UTF-8", 
        "ssl" : true, 
        "offlineEnabled" : true, 
        "lifecycleTimeout" : 300, 
        "privacyDefault" : "optedin", 
        "poi" : [ 
                    ["san francisco",37.757144,-122.44812,7000], 
                    ["santa cruz",36.972935,-122.01725,600] 
                ] 
    }, 
 "target" : { 
  "clientCode" : "myTargetClientCode", 
  "timeout" : 1 
 }, 
 "audienceManager" : { 
  "server" : "myServer.demdex.com" 
 } 
}

至少要更新您所使用的解决方案的以下值:
  • Adobe Analytics : rsids server
  • Adobe Target : clientCode
  • Adobe Audience Manager : server
有关详细信息,请参 阅SDK方法

调试

要启用SDK调试,请致电 ADBMobile.Config.setDebugLogging(true);
对于C Sharp和JavaScript应用程序,您需要通过完成以下步骤启用本机代码调试(本机代码调试是C++应用程序的默认设置):

C锐化

  1. 右键单击项目,单击“属性” >“调 试”选项卡 。
  2. 将调试器类型下拉菜单更改为​ 仅本机

JavaScript

  1. Right-click the project, click Properties > Configuration Properties > Debug tab .
  2. Change the debugger type drop down to Native Only .
就这么简单!您现在便可以在通用 Windows 平台应用程序中实施 Analytics、Target 和受众管理。