TPSDK Java - go to homepage
TPSDK Java logo

TPSDK Java

Java Facade Integration

This guide explains how to integrate the TPSDK facade into an Android Studio project.
These steps are intended as a reference—there are often multiple ways to achieve the same result.

Create a New Project

Create a new project in Android Studio.
Once your project is set up, go to File > New > Import Module.
In the file chooser, navigate to the CatalystFacadeX folder included in the SDK zip file.

Import the CatalystFacadeX module so it becomes part of your project.

 

Copy Libraries and Native Files

TPSDK uses different technologies to provide outputs for Java and C#.
A core part of this stack is native libraries, which must be copied manually.

There are several ways to import native files in Android Studio.

The recommended project structure is as follows. With this layout, Android Studio and Gradle will detect the native files automatically, and you won’t need to modify your Gradle files:

. 
├── app.iml
├── build
├── build.gradle
├── libs                    // Directory for your JAR/AAR libraries
├── proguard-rules.pro
└── src
    └── main                // Main application
        ├── AndroidManifest.xml
        ├── java
        ├── jniLibs         // Directory for your JNI libs (.so files)
        └── res
  • Copy all .so files into the jniLibs folder.
  • Copy all .aar files into the libs folder.

 

Adjust Gradle Files

At this point, a simple Make Project command will fail because the facade is not yet referenced by your app.

To build the project, update the build.gradle file of your main module (e.g., app) to add dependencies for the facade and native libraries, especially if your folder structure differs from the example above.

dependencies {
    implementation fileTree(include: ['*.aar'], dir: 'libs')
    implementation project(path: ':CatalystFacadeX')
    api files('../trimble/empowerlib-1.2.0.26.aar')
    api files('../trimble/Trimble.Licensing.Android.aar')
    api files('../trimble/trimble.jssi.core-release.aar')
    api files('../trimble/trimble.jssi.android.communicators-release.aar')
    api files('../trimble/JTDDTransformation-release.aar')
}

You also need to tell Gradle where the native files are located.
Extend the android section of your Gradle file as follows:

sourceSets {
    main {
        jniLibs.srcDirs = ['libs']
    }
}

Finally, run a Gradle sync and then Make Project to complete the integration.
Your project should now build without errors.

 

Using the Facade

You can now initialize the facade with code like:

CatalystFacade facade = new CatalystFacade(myAppGUID, this);

where myAppGUID is either the GUID from the facade sample or the one provided by Trimble.

Note:
You may need to adjust your manifest permissions before deploying the application.
For details on required permissions, please refer to the documentation.