Source Code Structure

The mobile app of Hello Thing-IF is built from the following source files.

This topic outlines each file and directory. The subsequent topics explain each class in detail one by one.

  • AndroidManifest.xml/HelloThingIF.java

    These are the Android manifest file and the application class.

    The Application class, HelloThingIF runs when the mobile app launches based on the setting in AndroidManifest.xml.

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:name=".HelloThingIF">
    

    The HelloThingIF class is called at the app's launch because the class name is specified in android:name.

  • MainActivity.java/LoginFragment.java/CommandFragment.java

    These three classes implement the user interface of the mobile app. According to the setting in AndroidManifest.xml, MainActivity is called as the activity at the app's launch. It internally switches to LoginFragment and CommandFragment.

  • PromiseAPIWrapper.java

    This is a wrapper class to call APIs which access Kii Cloud and Thing Interaction Framework with promises through JDeferred. The next topic explains promises.

  • command

    The command directory contains classes of commands and state items based on the schema of Thing Interaction Framework. Every class is converted to JSON format to exchange with Thing Interaction Framework.

  • fcm

    The fcm directory contains the implementation used to receive push notifications via FCM. This directory is included only in the sample which uses FCM. The implementation in the fcm directory is based on the steps described in Android (FCM) Push Notification Tutorial. AndroidManifest.xml also contains settings for push notification.

    This implementation is based on the samples published as parts of the GCM and FCM tutorials by Google. See the push notification tutorial for the details of its design.

  • util

    A Utility class, ProgressDialogFragment.java, is provided. This class displays the ProgressDialog.


What's next?

The next topic briefly introduces technologies used in the sample code.

Go to Third Party Technologies.

The subsequent topics explain the sample app with snippets of the source code. Kii recommends you to understand the snippets within the context of the entire source code downloaded to your computer.