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.
You can install the SDK using npm or by downloading the SDK binary in a browser.
The following is an explanation of how to download the SDK binaries in a browser; for instructions on how to download the SDK using npm, see Running the SDK on Node.js.
Configuring your project
Follow the steps below to add Kii Cloud SDK to your application project.
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.
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.
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>
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.JP); // Initialize other components. ... }; </script> </head>
Insert your application's AppID in the placeholder
___APPID___
. You can put an arbitrary value in the placeholder___APPKEY___
.
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. Titanium is usable only in SDK v2 series. The Titanium is no longer supported in SDK v3 series.