Reputation: 3064
How do we measure device usage through an app? I see apps like moment keeping track of how much the phone was in use in last 24 hours (as total screen time). Is there an API from iOS SDK or infer through certain signals in iOS?
Basically want to able to answer - how long have you used (including but not limited to calls, imessages, apps, games) your phone today? I am happy to infer it but need to know what signals to look for.
Upvotes: 3
Views: 1896
Reputation: 523214
This is answered in the FAQ of the Moment app:
To automatically track your screen time, Moment must be running in the background. Apple only allows apps to run consistently in the background in very specific use cases. Tracking the places you go is one of those, which allows Moment to run in the background.
The app registers itself as a Location Service so that its code can still run in background, until the device is locked. Whenever the code is still running, it can be counted towards the usage time.
It may also use other background modes to improve reliability to stay in background, but you'll never know the exact mechanism unless you unpack their IPA.
Upvotes: 3