Adding the SDK to Your Web App

Kii Cloud SDK gives you the ability to manage your application users and data with only a few lines of client-side code.

Configuring your project

Follow the steps below to add Kii Cloud SDK to your application project.

  1. Download the Kii Cloud SDK ZIP file.

    First, download the library. Login to the developer portal (https://developer.kii.com) and click the SDK link in the "Download" page to start downloading the library.

  2. Uncompress the ZIP file for the Kii Cloud SDK.

    Two files, KiiSDK.min.js and KiiSDK.js will be extracted when you uncompress the SDK file. Select one of them and publish it together with components such as HTML files for your mobile app.

    The two files have the same functionality while KiiSDK.min.js doesn't contain unnecessary characters such as spaces in the source code. Use small KiiSDK.min.js for app release and readable KiiSDK.js for app development.

  3. Load the Kii Cloud SDK in the HEAD tag.

    Set to load the SDK JS file when the mobile app launches. Change the publishing directory of the SDK suitably. Please replace the Kii SDK file name and the directory as needed.

    <head>
      <script type="text/javascript" src="../js/KiiSDK.js"></script>
      ...
    </head>
    
  4. Add the following code where the page's onLoad handler is called.

    <head>
      ...
      <script type="text/javascript">
    
        window.onload = function() {
          // Initialize the Kii Cloud SDK. Call this method before any other Kii SDK API calls.
          Kii.initializeWithSite("___APPID___", "___APPKEY___", KiiSite.US);
    
          // Initialize other components.
          ...
        };
      </script>
    </head>
    

    Insert your application's AppID in the placeholder ___APPID___. You can put an arbitrary value in the placeholder ___APPKEY___.

    Also put your SiteID (KiiSite.US KiiSite.JP, KiiSite.CN3, KiiSite.SG, or KiiSite.EU) that you've specified on the developer's portal.

    The device ID needs to be specified as the fourth argument to analyze the application. See the sample code to analyze the application for the implementation method.

You can safely embed the AppID in your application as long as you apply the correct access control. See Security for more information.

Starting from version 2.1.12, jQuery becomes optional. You can use KiiSDK with/without jQuery.
Also, note our SDK switch XMLHttpClient automatically in the following priority.
1. If jQuery is defined, SDK uses jQuery ajax.
2. If XMLHttpRequest is defined, SDK uses XMLHttpRequest.
3. If Titanium is defined (use KiiSDK in Titanium), SDK uses Titanium.Network.HTTPClient.