You'd need some way to measure activity; on a PC this is pretty easy as you can tell when it's not idle. On smartphones you'd need some way of capturing user input or knowing when the phone is not idle; something you'd usually need OS-level permissions to check.
–
Ben Brocka♦Dec 15 '11 at 19:03

I'm primarily looking for the computer side of things, so is that a vote of confidence for "Computer is not idle" = "User is on computer"?
–
Patrick PeriniDec 15 '11 at 19:09

Is this a question of the app knowing if it's being used on a computer vs. a phone, or working in the background to know what equipment the user is using? Or some other scenario?
–
Taj MooreDec 15 '11 at 20:48

Working the background to know what device the user is using.
–
Patrick PeriniDec 15 '11 at 21:29

1

I asked this in my answer, but probably should have put it here - For your purposes, is it worse to be wrong in one direction or another (false positive vs. false negative)?
–
peteorpeterDec 16 '11 at 15:27

3 Answers
3

Functionally, I think it's pretty clear what evidence indicates a user is actively using a given device:

Recent user input

That's it. The input device could be waking up the device, logging in, triggering any mouse event (move, scroll, click, etc.), triggering any touch event (tap, drag, etc.). With desktop PC's (dying breed that they are) and plugged-in laptops and mobile devices, you can't count on the device being "not idle" to mean there is a person sitting there.

A tricky and major exception to this rule is when the user is doing something passive for an extended period of time - ie watching a movie. Not sure how to handle that, frankly.

How bad is it if you are wrong? Is it worse to be wrong in one direction (false positive vs. false negative)?

Technically, this is probably a crazy-hard, make-lots-of-compromises-and-educated-guesses problem, but I think your goal should be to see whether there has been recent user input.

To answer your question: a false positive is far worse than a false negative. In my case, a false negative results in the duplication of an alert. A false positive involves potentially missing that alert. I really like this answer, and hopefully I can find some technical implementations for how to utilize the "recent user input" metric.
–
Patrick PeriniDec 16 '11 at 15:47

There are several scenario's you have to take in to consideration. Electronic devices can be: 1. turned on
2. turned off
3. in standby (screen saver mode)
4. in use (user activity or application on the foreground)
5. occupied (by someone else) or busy
6. locked
7. no status/unknown

If you want to make sure the user is using one of the devices, you should get some sort of fingerprint or photo match.

The determinants when a user is idle etc depends on the user itself, via settings. Or a smart self-learning application. Or you should work with a "countdown" to give feedback how long it has been user activity is detected. For instance a green icon (in case the device was on) that fades to the standby color and fading further as time goes by.

Have you considered whether it's necessary to sense different devices? For example, if you're trying to to handle alerts, a notification queue is a common UI and code pattern. With the same controller logic plugged into each platform's notification system, you can get a familiar user experience, multiple alert handling, persistence across reboots, fewer cross platform headaches, plenty of preexisting code, established guidelines for each platform, etc.