Implementation of the Application Class

First, we will look into the HelloKii class that inherits the Application class.

In the HelloKii class, we initialize the Kii Cloud SDK as follows:

public void onCreate() {
  super.onCreate();

  // Initialize the Kii Cloud SDK.
  Kii.initialize("12345678", "abcdef0123456789abcdef0123456789", Site.JP);
}

The Kii.initialize() method initializes the SDK. It has three parameters: AppID, AppKey (an arbitrary value), and the server location of the application in order.

There are many applications created by numerous developers on Kii Cloud. To distinguish the application, Kii Cloud uses the AppID. The value is generated when you create your application on the developer portal.

As illustrated in the figure below, the AppID is to be set in the initialization process of the mobile app. By setting the same AppID, the application data and users can be shared across multiple platforms; in the figure, the Android and iOS applications are sharing the same application data and users by using the same AppID 1111.

When you download Hello Kii application from the developer portal, the unique AppID and AppKey for you are assigned and embedded in the ZIP file automatically. When you open the project, you will find the initialization code, like the one shown at the top of this page, is already embedded.

If you are creating a new project, you need to embed the AppID and AppKey by yourself. To check the AppID, click the gear icon at the upper-right corner of the developer portal to expand the menu icons and click the key icon.

The AppID and AppKey will pop up as follows:

Reminder

It is not possible to attack your application by knowing its AppID. If a malicious user obtains your application's ClientID and ClientSecret, however, they will be able to access all of your application data as the app administrator. The ClientID and ClientSecret, therefore, need to be secured just like the login password of the developer portal.

When you are sending a question to Kii support team, you only need to provide the AppID and server location.


What's next?

Let's check how the login screen is implemented. We will explain how the APIs are used.

Go to Login Screen Implementation.

If you want to learn more...