Skip to content

Background Process Polling on Android

Bob Evans edited this page Oct 9, 2013 · 1 revision

Work underway

Recently, we had need to implement polling of running processes as a way to detect when a user opened an app.

On Android, there are problems with this. The only ApplicationManager api that works reliably is the RecentTask list, which returns package names for apps in the MRU order.

The prototype starts polling this api when the user turns the screen on (We recognize this with the User Presence trigger). We poll once per second, recording the Recent Tasks.

If the task of interest, as specified in an experiment trigger definition, pops onto the Recent Task list, or rises in position, then we consider that an opening of the app and fire this to Paco. It then creates the notification for the experiment.

If the user closes the phone, we stop polling.

Clone this wiki locally