Skip to content

TPA Requirements

cayden edited this page Apr 9, 2023 · 3 revisions

TPA Android App Requirements

Make sure all of these requirements are met for your app to work properly as a TPA.

  1. You compile the SGMLib in your app's build.gradle:
dependencies {
    ...
    <TODO add SGMLib deployed Android library reference> //make sure you include this line
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.2.0"
    ...
}
  1. You created an Android service that extends SmartGlassesAndroidService and starts the SmartGlassesAndroidService parent:
    public SgmLibDebugAppService(){
        super(MainActivity.class,
                "my_app_name",
                <my id integer here",
                "My App Message Here",
                "My App Sub-message Here",
                <my-drawable-resource-here>);
    }

And added the FOREGROUND_SERVICE permission near the top of the AndroidManifest.xml file:

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
  1. You added the SGM intent filter to your Android Manifest to your SGM TPA service:
        <service android:name="<your service name here>"
            android:exported="true">
            <intent-filter>
                <action android:name="SGM_COMMAND_INTENT" />
            </intent-filter>
        </service>
  1. You started an instance of the SGMLib SDK in your service:
sgmLib = new SGMLib(this);
  1. You defined command callbacks, created an SGMCommand, and registered a command with the SGM:
SGMCommand myCommand = new SGMCommand("My command name", UUID.fromString("my UUID string here"), new String[]{"My command Phrase"}, "My command description");
sgmLib.registerCommand(myCommand, this::myCallback);