Skip navigation links

Package fi.moprim.tmd.sdk

This package includes classes, interfaces, and enumerations related to the TMD for our Android SDK.

See: Description

Package fi.moprim.tmd.sdk Description

This package includes classes, interfaces, and enumerations related to the TMD for our Android SDK. Moprim TMD Android SDK requires to initialize the SDK first. Initialization should happen as early as possible, and it requires connection to the Internet. The easiest way to add the initialization code to an Application class.
 import android.app.Application;
 import android.content.Context;
 import fi.moprim.tmd.sdk.TMD;
 import fi.moprim.tmd.sdk.TmdConfigBuilder;

 public class MyApplication extends Application {
      @Override
      public void onCreate() {
          super.onCreate();
          TmdConfigBuilder builder = new TmdConfigBuilder(this)
          .setSdkConfigEndPoint(getString(R.string.tmd_sdk_config_endpoint))
          .setSdkConfigKey(getString(R.string.tmd_sdk_config_key));
          // Initialise the TMD
          TMD.init(this, builder.build(), new TmdInitListener() {
              @Override
              public void onTmdInitFailed(TmdError tmdError) {
                  Log.e(HelloWorldApplication.class.getSimpleName(), "Initialisation failed: " + tmdError.name());
              }
              @Override
              public void onTmdInitSuccessful(String s) {
                  // s is the current installation ID, we'll put the UUID as the same just to demonstrate how to use the method
                  // replace with your own user id in production
                  TMD.setUUID(s);

                  // If you want to do trigger some process when the data is periodically uploaded to the cloud
                  Intent intent = new Intent(HelloWorldApplication.this, TmdUploadIntentService.class);
                  PendingIntent callbackIntent = PendingIntent.getService(HelloWorldApplication.this, 0, intent,
                  PendingIntent.FLAG_UPDATE_CURRENT);
                  TmdCloudApi.setCallbackIntent(callbackIntent);
              }
          });
      }
 }
 
Then you can start and stop the TMD at your own convenience: You can correct an activity label with TmdCloudApi.correctActivity(android.content.Context, fi.moprim.tmd.sdk.model.TmdActivity, java.lang.String)
Skip navigation links