[英]How can I monitor user activities in my app without touching the main class that extends Activity?
Suppose an app project is already written, all you want to do is to additionally write a somehow standalone script that captures the onClick, onFocusChange or even onAppear in the app. 假设已经编写了一个应用程序项目,您要做的就是另外编写一个独立的脚本来捕获应用程序中的onClick,onFocusChange或onAppear。 Is that even feasible?
那可行吗? How robust is the approach?
该方法的鲁棒性如何?
All answer I found was to fully add listeners (or global listeners, although less comprehensively functional) for each item or so, which is a boring work for a large project, and not always desired at the end of a production process(where I just cut in). 我发现的所有答案是为大约每个项目完全添加侦听器(或全局侦听器,尽管功能不那么全面),这对于大型项目来说是一项无聊的工作,并且在生产过程的最后(我只是在切入)。
Another purposed approach was to locate the root of the nodes and scan from there? 另一种有针对性的方法是找到节点的根并从那里扫描? Correct me if that's a dead end.
如果那是死胡同,请纠正我。 Other answer mentioned spying app, which is not the case, since it's the original developer who wants to track everything from inside the app.
其他答案提到了间谍应用程序,情况并非如此,因为原始开发人员想从应用程序内部跟踪所有内容。
I am not sure, if this solves your problem but have your extension of views. 我不确定,这是否可以解决您的问题,但您可以扩展意见。 Eg:
MyTextView extends TextView
then just override the touchEventHandlers, log what you want and dispatch the event down to the listeners. 例如:
MyTextView extends TextView
然后仅覆盖touchEventHandlers,记录所需内容,然后将事件分派给侦听器。
So instead of normal TextViews
, use MyTextView
. 因此,请使用
MyTextView
代替普通的TextViews
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.