Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Triggers

Bob Evans edited this page Jan 23, 2015 · 3 revisions

Triggers are currently only available on Android.

With iOS 8, there is the possibility that we could do some app -> Paco triggering.

On Android, most triggers are driven by Broadcast events delivered via the Android Intent system. Some are the result of Paco polling some input looking for a particular state.

Broadcast-based Triggers

The Paco client listens for Broadcast events and if there is a running experiment that is interested, it creates a Notification to the user to respond to that experiment.

Currently, we have implemented three Broadcast-event triggers, though we can easily add more as research needs them.

  • Phone call hangup - it's what you think it is
  • User present - User has opened the phone and unlocked the key guard
  • Paco Trigger - a custom broadcast event that Paco listens for and that any app can send. It distinguishes each different callers with a unique sourceIdentifer. If there is an experiment interested in that source identifier, then it creates the Notification. See Instrumenting Your App for more information.

Polling-based Triggers

Currently, there is one polling-based trigger event:

App Used: which takes the full package name of an app and detects when the user has opened that app. When the screen is on, and an experiment cares about the usage of an app, Paco will poll the most recently used task list every second looking for new apps to appear and testing them against the app of interest. If it finds it, this causes a logging event and/or a notification for the user to respond to the experiment form.

Future Trigger work

  • More Flexible Trigger criteria Triggers should be much more flexible. Researchers often want to trigger on a compound condition

  • More flexible actions based on a trigger Right now, a trigger moment can lead to a new datum with the trigger payload or a notification to respond to an experiment. Researchers want to have much more control. We need to implement an action script section that allows the researcher to define a javascript set of steps to be executed as the result of a Trigger firing. We will use Rhino for this.

We need user interface to allow the researcher to specify the actions after a trigger. The options include

  • Create a Notification to respond to experiment
    • Specifies delay, timeout, etc..
  • Log the Trigger
    • records the trigger time and ID and any payload it carries
  • Send a Notification Message to the user
    • opens text field for message
  • Create a custom action in Javascript
    • Opens a Javascript editor textarea that allows them to enter a script.

Clone this wiki locally