TPSDK Java - go to homepage
TPSDK Java logo


Java facade integration

The following few steps explain how to integrated the TPSDK facade into an Android Studio Project. Note that the following steps are meant to guide the developer - as always there are multiple ways to reach the goal.

Create a new Project

Create a new project in Android Studio. After everything is set up, click on File and New, then select Import Module. In the following file chooser navigate to the CatalystFacade folder as part of the zip file shipping with the SDK.

Import the CatalystFacade module so it becomes a part of your project.


Copy/ paste libraries and native files

TPSDK uses different technologies to create outputs like Java and C#. Part of this technology stack is a set of files and (native) libraries typically shipping as *.so and *.aar files.

Those native files plus additional libraries need to get copied into the folder of the project. A typical example may look like this:

|- .gradle
|- .idea
|- CatalystFacade                        //imported Catalyst facade module
|- app                                   //the main application
    |- libs                              //native files within the main application
        |- arm64-v8a                     //ARM64bit folder
        |- armeabi-v7a                   //ARM32bit folder
|- trimble.jcontracts                    //TPSDK contracts 
|-    //TPSDK communicators used for communication 
|- trimble.jssi.core                     //TPSDK core interfaces

The folders trimble.jcontracts, and trimble.jssi.core can get copy/ pasted into the root directory of the project.

The empowerlib- Android library can get copy/ pasted into the root directory of the project.

The Trimble.Licensing.Android.aar Android library can get copy/ pasted into the root directory of the project.

The native drivers located in the platform folders arm64-v8a, armeabi-v7a etc can get copied from the CatalystFacadeDemo\libs folder into the app\libs folder of the project. Its important to keep the structure of the libs folder as the native files look explicitly for this structure.


Adjust gradle files

As of now a make project command would fail miserably as the facade is not made known to the app.

To finally build the project the build.gradle file of the main module (something like needs a dependency to the facade

dependencies {
    implementation 'androidx.appcompat:appcompat:1.2.0'
    api project(':CatalystFacade')

Its also required to tell java where the native files are located. Hence the android section of the gradle file needs also an extension

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']

Finally a gradle sync and make project are required to finish the integration. The project should build without complaints.

Using the facade

We can now initialize that facade via something like

CatalystFacade facade  = new CatalystFacade(myAppGUID, this);

where myAppGUID is either the GUID from the facade sample or the received GUID from Trimble.

Note that the manifest permissions need some adjustment before deploying the application. For details on manifest permission please check the documentation.