Android: Detect General Use by User

♀尐吖头ヾ 提交于 2019-12-31 03:16:32

问题


I am working on an application that monitors phone use (specifically, what time its being used). Presently, I log times of phone calls, SMSs, MMSs, Screen turning on, screen turning off, and keygaurd unlocking. Now I want to determine when the user does any interaction other than whats listed above. Like:

1) Application use (Detect when an application is launched by the user and/or when it is actively being used by the user)

For this I have been playing with the Activity Manager but there does not seem to be a good way to get the information I need. It has information about whats in the foreground, background and what services are running, but lacks information on the amount of use, time of use, time of application launch, ect.

2) General Screen Interaction (Detect when a user is interacting with the screen in any/all ways)

I have yet to find any way to detect any form of general screen or keyboard interaction while my activity is not in the foreground. Any help here would be appreciated.

3) Other (I am open to other 'events' that would represent a user interacting with their phone)

I am open to other ideas about what I could possible look for when detecting user activity.


回答1:


Presently, I log times of phone calls, SMSs, MMSs, Screen turning on, screen turning off, and keygaurd unlocking.

Note that your SMS/MMS support is dependent upon an undocumented/unsupported API and may not work on all devices or in future versions of Android.

Detect when an application is launched

Fortunately, there are no broadcasts for this, to help limit the scope of spyware.

General Screen Interaction (Detect when a user is interacting with the screen in any/all ways)

Fortunately, there is no way to determine this, to help limit the scope of spyware.



来源:https://stackoverflow.com/questions/7068036/android-detect-general-use-by-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!