[英]Recording frequency of taps on screen while app is in background
Let's say I have an app A and an app B. App A runs and does calculations in the background and I have an app B running on the main thread.假设我有一个应用程序 A 和一个应用程序 B。应用程序 A 在后台运行并进行计算,我有一个应用程序 B 在主线程上运行。 While app B runs on main thread I tap on screen 120 times, is there a way for an app A record screen taps even though it was running in the background?当应用程序 B 在主线程上运行时,我在屏幕上点击了 120 次,有没有办法让应用程序 A 记录屏幕点击,即使它在后台运行?
You can do this via an overlay.你可以通过覆盖来做到这一点。 Create a dummy view something like 1 pixel and place it somewhere out the way in one of the corners.创建一个类似于 1 像素的虚拟视图,并将其放置在一个角落的某个地方。 Then set up a touch event listener ( onTouch ) make sure it returns false though or the actual place you touch wont register the event.然后设置一个触摸事件侦听器( onTouch ),确保它返回 false ,否则您触摸的实际位置不会注册该事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.