最近想做一个微信添加好友功能,所以到处研究如何实现该功能。然后买了一本C++的书从头研究到尾,从main函数的使用到标准库以及C++新特性的开发,而且向公司借了一本关于linux编辑shell命令的研究,接着把ndk和jni研究了一篇,最后把jni和linux内核inotify文件观察器研究了一遍,最终能使用jni写底层C去执行了shell命令,而且还做了一个使用inotify监听app应用文件夹删除即卸载的功能。后面我听说有微信抢红包的功能,我就想了一下。
我的微信添加好友功能是这样的->首先打开微信->监听微信上的控件->在应用上点击搜索好友界面->输入手机号码->点击搜索按钮进入详细资料->自动点击添加通讯录进入微信发送界面->自动点击发送->添加好友完成。整个流程就是这样子的。那么这个微信抢红包与我这个功能有何关系呢?我随下下载了微信抢红包的源码。结果发现AccessibilityService这个对象。那么我们来一场AccessibilityService的详解。
随后看了google的AccessibilityService这个对象的翻译:
An accessibility service runs in the background and receives callbacks by the system when AccessibilityEvents 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。
英文翻译过来就是:一个辅助服务在后台运行,并在系统重启时辅助激发事件接收回调。这样的事件表示在用户界面中的一些状态转移,例如,焦点已改变,一个按钮被点击等这样的服务可以选择请求的能力,用于查询活动窗口的内容。辅助功能服务的发展需要扩展此类和实现它的抽象方法。
这段话说明了AccessibilityService这个对象是一个辅助类。可以作为文字转语音(这个不支持中文),触觉反馈,手势操作,轨迹球和手柄操作。
结构
我的微信添加好友功能是这样的->首先打开微信->监听微信上的控件->在应用上点击搜索好友界面->输入手机号码->点击搜索按钮进入详细资料->自动点击添加通讯录进入微信发送界面->自动点击发送->添加好友完成。整个流程就是这样子的。那么这个微信抢红包与我这个功能有何关系呢?我随下下载了微信抢红包的源码。结果发现AccessibilityService这个对象。那么我们来一场AccessibilityService的详解。
随后看了google的AccessibilityService这个对象的翻译:
An accessibility service runs in the background and receives callbacks by the system when AccessibilityEvents 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。
英文翻译过来就是:一个辅助服务在后台运行,并在系统重启时辅助激发事件接收回调。这样的事件表示在用户界面中的一些状态转移,例如,焦点已改变,一个按钮被点击等这样的服务可以选择请求的能力,用于查询活动窗口的内容。辅助功能服务的发展需要扩展此类和实现它的抽象方法。
这段话说明了AccessibilityService这个对象是一个辅助类。可以作为文字转语音(这个不支持中文),触觉反馈,手势操作,轨迹球和手柄操作。
结构
public abstract c