Class TMD


  • public final class TMD
    extends java.lang.Object
    Use this class to initialize the TMD init(Context, TmdConfig) as soon as possible in your Application subclass Application.onCreate() method.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String getInstallationId()
      Retrieve the unique application installation id of application using the SDK
      static TMD getInstance()  
      android.app.PendingIntent getStartCallbackIntent()
      Deprecated.
      since v.0.5.0
      java.lang.Class<? extends androidx.work.ListenableWorker> getStartCallbackWorkerClass()  
      java.lang.String getUUID​(android.content.Context context)  
      void init​(android.content.Context applicationContext, TmdConfig tmdConfig)
      Initialize Moprim TMD for a given Application.
      boolean isConfigured​(android.content.Context context)
      Returns true if the TMD was able to receive the configuration from the Cloud
      boolean isInitialized()  
      static boolean isTmdRunning​(android.content.Context context)  
      void setStartCallbackIntent​(android.app.PendingIntent intent)
      Deprecated.
      since v.0.5.0
      void setStartCallbackWorkerClass​(android.content.Context context, java.lang.Class<? extends androidx.work.ListenableWorker> startCallbackWorkerClass)
      Sets an callback worker for the background start of the TMD.
      void setUUID​(android.content.Context context, java.lang.String uuid, OnSetUUIDListener listener)
      Set an unique user id to gather data from multiple installations.
      static TmdStartReturnCode startForeground​(android.content.Context context, int id, android.app.Notification notification)
      Starts the TMD service for the given context
      static void stop​(android.content.Context context)
      Stops the TMD service
      static void stop​(android.content.Context context, boolean fromUserAction)
      Stops the TMD service
      void testInit​(android.content.Context applicationContext, TmdConfig coreConfiguration)  
      static boolean wasTmdStarted​(android.content.Context context)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static TMD getInstance()
      • setStartCallbackIntent

        @Deprecated
        public void setStartCallbackIntent​(android.app.PendingIntent intent)
        Deprecated.
        since v.0.5.0
        Sets an callback intent for the background start of the TMD.
        Parameters:
        intent - the intent to be executed
      • getStartCallbackIntent

        @Deprecated
        public android.app.PendingIntent getStartCallbackIntent()
        Deprecated.
        since v.0.5.0
        Returns:
        the callback that will be called during background start of the TMD
      • setStartCallbackWorkerClass

        public void setStartCallbackWorkerClass​(@NonNull
                                                android.content.Context context,
                                                @Nullable
                                                java.lang.Class<? extends androidx.work.ListenableWorker> startCallbackWorkerClass)
        Sets an callback worker for the background start of the TMD.
        Parameters:
        startCallbackWorkerClass - the class of the job to start the TMD from background
      • getStartCallbackWorkerClass

        @Nullable
        public java.lang.Class<? extends androidx.work.ListenableWorker> getStartCallbackWorkerClass()
      • init

        public void init​(@NonNull
                         android.content.Context applicationContext,
                         TmdConfig tmdConfig)

        Initialize Moprim TMD for a given Application.

        The call to this method should be placed as soon as possible in the Application.onCreate() method.
        Parameters:
        applicationContext - Your Application context.
        Throws:
        java.lang.IllegalStateException - if it is called more than once.
      • testInit

        public void testInit​(@NonNull
                             android.content.Context applicationContext,
                             TmdConfig coreConfiguration)
      • startForeground

        public static TmdStartReturnCode startForeground​(@NonNull
                                                         android.content.Context context,
                                                         int id,
                                                         android.app.Notification notification)
        Starts the TMD service for the given context
        Parameters:
        context - the given context
      • stop

        public static void stop​(@NonNull
                                android.content.Context context)
        Stops the TMD service
        Parameters:
        context - the context to stop the tmd service
      • stop

        public static void stop​(@NonNull
                                android.content.Context context,
                                boolean fromUserAction)
        Stops the TMD service
        Parameters:
        context - the context to stop the tmd service
        fromUserAction - tells if the stop was coming from a user action (TMD will not restart automatically)
      • isTmdRunning

        public static boolean isTmdRunning​(@NonNull
                                           android.content.Context context)
        Parameters:
        context - the context
        Returns:
        true if the TMD service for this app is already running
      • wasTmdStarted

        public static boolean wasTmdStarted​(@NonNull
                                            android.content.Context context)
        Parameters:
        context - the context
        Returns:
        true if the TMD service for this app was started
      • getInstallationId

        @WorkerThread
        public java.lang.String getInstallationId()
        Retrieve the unique application installation id of application using the SDK
        Returns:
        public static String getUUID() { return null; }the unique installation id
      • getUUID

        public java.lang.String getUUID​(@NonNull
                                        android.content.Context context)
      • setUUID

        public void setUUID​(@NonNull
                            android.content.Context context,
                            java.lang.String uuid,
                            OnSetUUIDListener listener)
        Set an unique user id to gather data from multiple installations. This identifier may have the side effect to disable data collection from former installations TODO Enable the registration via a separate API in the cloud
        Parameters:
        context - the context of the application
        uuid - the uuid
        listener - Listener to see if the UUID can be set for this installation
      • isInitialized

        public boolean isInitialized()
        Returns:
        true if the TMD has been properly initialized
      • isConfigured

        public boolean isConfigured​(@NonNull
                                    android.content.Context context)
        Returns true if the TMD was able to receive the configuration from the Cloud
        Returns:
        true is the configuration was obtained from the Cloud for the identified user