Skip to content
lcgao edited this page Nov 5, 2019 · 13 revisions

Temi SDK is your way to develop skills for temi that take advantage of your robot's unique abilities! All development for temi is done on Android by creating an android application and importing Temi's SDK. Temi's tablet runs on Android 6.0.1 (SDK level 23). Always use the Sample app as a reference.

Temi-Android Application Requirements:


  1. AndroidManifest.xml -
    • Include the following within the Application section: android:theme="@style/SkillTheme". This will remove the action bar included at the top of any standard application in order to make room for temi's navigational top bar.
    • All communication betweeen temi OS and your application is linked through the meta-datas included in the AndroidManifest.xml. Below you will see two meta-datas that (1) displays your app in temi OS's application selection and (2) specifies which NLP intents to listen for:
          <meta-data
                android:name="com.robotemi.sdk.metadata.SKILL"
                android:value="@string/app_name" />
    
          <meta-data
                android:name="com.robotemi.sdk.metadata.ACTIONS"
                android:value=
                      "home.welcome,
                       home.dance,
                       home.sleep" />

2. MainActivity.java -

  At the start of the MainActivity, you might want to implement specific interfaces based on which types of callbacks you are interested in. For example,
  ``` java
    public class MainActivity extends AppCompatActivity implements
        Robot.NlpListener,
        OnRobotReadyListener,
        Robot.ConversationViewAttachesListener,
        Robot.WakeupWordListener,
        Robot.ActivityStreamPublishListener,
        Robot.TtsListener,
        OnBeWithMeStatusChangedListener,
        OnGoToLocationStatusChangedListener,
        OnLocationsUpdatedListener
  ```

  After doing so, Android Studio will prompt you to implement specific methods.

  You will also need to add and remove each listener by doing:

  ``` java
    protected void onStart() {
        super.onStart();
        Robot.getInstance().addOnRobotReadyListener(this);
        Robot.getInstance().addNlpListener(this);
        Robot.getInstance().addOnBeWithMeStatusChangedListener(this);
        Robot.getInstance().addOnGoToLocationStatusChangedListener(this);
        Robot.getInstance().addConversationViewAttachesListenerListener(this);
        Robot.getInstance().addWakeupWordListener(this);
        Robot.getInstance().addTtsListener(this);
        Robot.getInstance().addOnLocationsUpdatedListener(this);
    }

    protected void onStop() {
        super.onStart();
        Robot.getInstance().removeOnRobotReadyListener(this);
        Robot.getInstance().removeNlpListener(this);
        Robot.getInstance().removeOnBeWithMeStatusChangedListener(this);
        Robot.getInstance().removeOnGoToLocationStatusChangedListener(this);
        Robot.getInstance().removeConversationViewAttachesListenerListener(this);
        Robot.getInstance().removeWakeupWordListener(this);
        Robot.getInstance().removeTtsListener(this);
        Robot.getInstance().removeOnLocationsUpdateListener(this);
    }
  ```

  Overriding the onRobotReady method allows your app to be placed as a shortcut in temi's top bar. For example:
  ``` java
    public void onRobotReady(boolean isReady) {
        if (isReady) {
            try {
                final ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
                robot.onStart(activityInfo);
            } catch (PackageManager.NameNotFoundException e) {
                throw new RuntimeException(e);
            }
        }
    }
  ```
Clone this wiki locally