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.<p>The trigger response is in your local TriggersBroadcastReceiver that is registered in the manifest.</p>
      Parameters:
      context - <ul> <li>the context to use, preferably the application context</li> </ul>
      appKey - <ul> <li>the application key for your application</li> </ul>
      subscriptions - <ul> <li>the subscriptions listing the proximity beacons to listened for</li> </ul>
    • 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.<p>Note that it takes about 20 seconds for the reset to occur.</p>
    • 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.<p>Note that it takes up to 20 seconds for new subscription to start If triggers has not been been started, this will call startMonitoring</p>
      Parameters:
      context - <ul> <li>the context to use, preferably the application context</li> </ul>
      appKey - <ul> <li>the application key for your application</li> </ul>
      subscriptions - <ul> <li>additions subscriptions to listened for</li> </ul>
    • unsubscribe

      public static void unsubscribe(@NonNull Context context, @NonNull EditorKey appKey, ArrayList<String> subscriptionNames)
      Remove subscriptions by name from active monitoring.<p>Note that it takes up to 20 seconds for subscriptions to be removed.</p>
      Parameters:
      context - <ul> <li>the context to use, preferably the application context</li> </ul>
      appKey - <ul> <li>the application key for your application</li> </ul>
      subscriptionNames - <ul> <li>subscriptions to be removed</li> </ul>
    • 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.<p>For internal use only</p>
    • jobFinished

      protected static void jobFinished(@NonNull Context context, @NonNull EditorKey appKey)
      Internal function used by the triggers jobScheduler.<p>For internal use only</p>