How to determine user interaction of any type?

SECURITY QUESTION: I do not understand how this happens, but readers of these questions come up with the idea that solutions to this problem pose a security risk. Therefore, please keep in mind that all the data that interests me measures the user's time in / activity. All this. What the user did - I'm NOT interested at all!


I need a very simple concept, but I can not find a solution. I would like to start the process (in the background) and listen to the user interface.

Thus, the user touches the screen -> my method starts.

The user unlocks the phone → my method starts.

Types of users on a physical keyboard -> my method starts.

In short, my method does NOT start when the phone is on the table :-) Please note that the interaction is with the entire phone, not with my application, and I am not interested in the user typing the letter "K", I’m not even interested in what the user typed something, all that bothers me is that the user somehow used the phone.

Btw. the state when the user walks while listening to music (the phone in his pocket) is NOT an interaction.

I am looking for a trigger - something like, INTERACTION_DETECTEDor (vice versa) a callback method that is set as reportInactiveUser(10*1000), and it will be called if the user is inactive for 10 seconds.

QUESTION , how to detect user interaction?

Appointment: for measurement of time of use of phone manually.

(absence) PROGRESS

, BatteryStatsImpl . BatteryStatsService, , , , IBatteryStats, , , - getStatistics, ( , ). , - .

, ;-).

+5
1

.

. * , .

, this.

0

All Articles