1. AccessibilityService的介绍
前几天在浏览技术博客时,看到一篇文章自动抢红包,自动安装原理之AccessibilityService。发现了Android提供了一个很有趣的辅助类——AccessibilityService!决定自己也来探索一番。
先来看看AccessibilityService官方的介绍:
Accessibility services are intended to assist users with disabilities in using Android devices and apps. They run in the background and receive callbacks by the system whenAccessibilityEvents are fired. Such events denote some state transition in the user interface, for example, the focus has changed, a button has been clicked, etc. Such a service can optionally request the capability for querying the content of the active window. Development of an accessibility service requires extending this class and implementing its abstract methods.
英语不好,就不献丑了,大概意思是AccessibilityServices能辅助用户使用Android设备和app,其运行在后台并会监听系统诸如窗体改变、按钮点击等AccessibilityEvent事件,然后我们就能根据这些事件来完成一些操作了。也就是说,AccessibilityService能释放我们的双手,辅助我们完成一些我们平常主动地操作手机的动作。我的理解是,主要我们愿意并且不怕麻烦,几乎能用