Skip to content

Triggering rules

MGasztold edited this page Nov 25, 2016 · 4 revisions

Before any event is executed by the SDK, the following delegate method is called:

/**
 * Invoked before ruleFiredForEvent or notifyUserForEvent is executed. Gives the opportunity to stop the event.
 *
 * @param event event
 * @return true to proceed to the execution of the event, false to stop it.
 */
 boolean shouldNotifyUserForEvent(UbuduEvent event);

If the mobile app returns true in the shouldNotifyUserForEvent implementation and when the following method has been called in the SDK configuration:

        mBeaconManager.setEnableAutomaticUserNotificationSending(true);

then the following delegate method is called (note that true is also a default setting for this flag so, if automatic rules handling is needed, calling this method is redundant):

/**
 * This message is sent to the delegate when the rule proximity conditions are
 * all fulfilled, shouldNotifyUserForEvent returned true and automatica user notification sending is set to `true`.
 */
 public void ruleFiredForEvent(UbuduEvent event);

With automatic user notifications sending set to true all the default actions defined for the rule in Ubudu Manager website will be automatically executed. Delegate method call is just to inform the app about the event giving an opportunity to process it in some additional way.

If you need custom event handling please see Custom event handling article.

Clone this wiki locally