Class TriggersService

All Implemented Interfaces:
ComponentCallbacks, ComponentCallbacks2

public class TriggersService extends IntentService
A background service for listening to Meridian triggers.
  • Constructor Details

    • TriggersService

      public TriggersService()
      Constructs the default TriggersService.
  • Method Details

    • startMonitoring

      public static void startMonitoring(@NonNull Context context, @NonNull EditorKey appKey, ArrayList<TriggersService.TriggerSubscription> subscriptions)
      Starts monitoring for new trigger events, if you intend to handle trigger notifications this method should be called either in an on boot handler or each time your application starts.

      The trigger response is in your local TriggersBroadcastReceiver that is registered in the manifest.

      Parameters:
      context -
      • the context to use, preferably the application context
      appKey -
      • the application key for your application
      subscriptions -
      • the subscriptions listing the proximity beacons to listened for
    • stopMonitoring

      public static void stopMonitoring(@NonNull Context context)
      Stops monitoring for Trigger notifications.
    • resetAllTriggers

      public static void resetAllTriggers(@NonNull Context context)
      Resets triggers cool downs.

      Note that it takes about 20 seconds for the reset to occur.

    • subscribe

      public static void subscribe(@NonNull Context context, @NonNull EditorKey appKey, ArrayList<TriggersService.TriggerSubscription> subscriptions)
      Add additional TriggersService.TriggerSubscription to the list of subscriptions being monitored.

      Note that it takes up to 20 seconds for new subscription to start If triggers has not been been started, this will call startMonitoring

      Parameters:
      context -
      • the context to use, preferably the application context
      appKey -
      • the application key for your application
      subscriptions -
      • additions subscriptions to listened for
    • unsubscribe

      public static void unsubscribe(@NonNull Context context, @NonNull EditorKey appKey, ArrayList<String> subscriptionNames)
      Remove subscriptions by name from active monitoring.

      Note that it takes up to 20 seconds for subscriptions to be removed.

      Parameters:
      context -
      • the context to use, preferably the application context
      appKey -
      • the application key for your application
      subscriptionNames -
      • subscriptions to be removed
    • onHandleIntent

      protected void onHandleIntent(Intent intent)
      Specified by:
      onHandleIntent in class IntentService
    • onRegisterTriggersJobAgainEvent

      public void onRegisterTriggersJobAgainEvent(TriggersService.RegisterTriggersJobAgainEvent event)
      Internal function used by the triggers jobScheduler.

      For internal use only

    • jobFinished

      protected static void jobFinished(@NonNull Context context, @NonNull EditorKey appKey)
      Internal function used by the triggers jobScheduler.

      For internal use only