Build and Test

Now that we've downloaded the sample code, let us build and test the mobile app.

Before we start, make sure that your Android Studio is properly configured for building and testing mobile apps. We assume that your Android Studio is all set.

Building Hello Kii

Unzip the sample code in any directory and open it in Android Studio as a project.

If you see a message saying that it is recommended to update the Android plugin for Gradle when you open the project, follow the on-screen instruction to update the plugin. Hello Kii was developed with Android Studio 1.5. You might not be able to build Hello Kii with a newer version of Android Studio without updating the plugin.

If Android Studio has a required plugin, you can build and test Hello Kii just like any other mobile apps. The Kii Cloud SDK will be downloaded and integrated automatically when you build the application.

If the build fails, check the error codes and messages recorded in logs to find the reason.

Testing Hello Kii

Run the mobile app in Android Studio to launch it. Now you can manipulate the app as you want.

In this tutorial, let's manipulate with the following steps:

You will find that the mobile app works as expected in these steps. Here, check that you can implement common features easily with Kii Cloud.

  1. You will see the following login screen after you launch the application.

  2. Type in the following user information and tap the "Sign Up" button.

    • Username: aaaa
    • Password: 1111

    When you tap the "Sign up" button, the application will communicate with Kii Cloud and create the specified user.

  3. The following data listing screen now shows up.

    There is no data at this point, so the list is empty.

  4. Tap the "Add Item" button three times.

    Tapping the "Add Item" button will create a new object and show it on the screen. At the same time, the same data is uploaded to Kii Cloud.

    Each object has a title such as MyObject 1. The number is incremented every time an object is added.

    Under the title, the URI of the KiiObject that corresponds to the object is displayed as an identifier of the object.

    You can also delete data by tapping it in the list.

  5. Exit the mobile app.

    Go back to Android Studio, and run the application again by choosing "Run" > "Run - 'app'".

  6. The login screen pops up again.

    Log in to the application with the credentials for the created user (username: aaaa and password: 1111) and tap the "Log In" button.

  7. You should be able to see the same list of data that you've seen in Step 4.

    This data is retrieved from Kii Cloud.

    If you tap the "Add Item" at this point, a newly created MyObject will have the suffix number 1. The suffix number is reset because Hello Kii does not preserve the number when the mobile app is closed; the feature for preserving the number is not implemented for the code simplicity.

  8. Relaunch the mobile app again to pop up the login screen.

    Now, let's register a new user. Type in the following login information and tap the "Sign up" button.

    • Username: bbbb
    • Password: 2222

  9. This time, you will see an empty list of data.

    This is because we are now referring the region different from that of user aaaa. If you log in again as the user aaaa, you will see the list of registered data again.


What's next?

We will show you how you can browse the application data on the developer portal. This feature is useful when you want to verify the data while you are developing and debugging your application.

Go to Check Data on the Developer Portal.