-
Notifications
You must be signed in to change notification settings - Fork 92
Background Process Polling on Android
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.