Show Menu
主題×

Developer quick start

以下是有關如何實作通用Windows平台程式庫的一些資訊。
若要實作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)中,如果您使用不同的語言,則可能需要修改。 When you consume winmd methods from winJS, all methods automatically have their first letter lowercased.
實施間的主要差別,是上下文資料使用的資料結構。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. 選取正確的程式庫版本,並瀏覽至相關的ADBMobile.winmd檔案。
    如需詳細資訊,請 參閱本頁的「選擇正確的版本 」一節。
  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 標籤中,選取「擴充功能 」,選取並新增「通用Windows平台應用程式的 Visual C++ 2015執行階段」 。
  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. Select the correct version of the library and add a reference to the associated ADBMobile.winmd file.
    如需詳細資訊,請 參閱本頁的「選擇正確的版本 」一節。
  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. 選取正確的程式庫版本,並瀏覽至相關的ADBMobile.winmd檔案。
  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 標籤中,選取「延伸功能 」,然後選取並新增「通用Windows平台應用程式的 Visual C++ 2015執行階段」 。
  8. Right-click your project and select Add > Existing Item .
  9. Browse to the file and click Add. ADBMobileConfig.json
  10. Right-click the ADBMobileConfig.json file in your solution and select Properties .
  11. With File Properties selected, ensure Package Action is set to Content.
    對於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: and rsids``server
  • Adobe Target : clientCode
  • Adobe Audience Manager : server
如需詳細資訊,請參 閱SDK方法

除錯

To enable debugging for the SDK, call . ADBMobile.Config.setDebugLogging(true);
對於C Sharp和JavaScript應用程式,您必須完成下列步驟以啟用原生程式碼除錯(原生程式碼除錯是C++應用程式的預設設定):

C Sharp

  1. Right-click the project, click Properties > Debug tab .
  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 和 Audience Management。