当前位置:网站首页>Start from here by counting the information of the broadcast room
Start from here by counting the information of the broadcast room
2022-07-19 13:37:00 【S-arige】
background
National short video ,mcn Institutions are blooming everywhere ,mcn The survival of 、 Development requires various methods . In a data-oriented society , We all hope to get more through data 、 More accurate data , So a friend wants to count the number of people entering the Tiktok live room and the basic information of people . Think of a gadget that turns pages automatically written before , I think this matter is not a small matter with a pinch in hand ? So he agreed . So I encountered a series of problems .
Normal process
1、 Use tools to locate specific view
2、 According to business , Yes view To operate
Problems encountered
How to find hope view? Students in a hurry can directly watch the final shortcut
Commonly used tools
2.1.1、ddms Medium dump view hierarchy for ui automator The new version Android studio It is no longer provided in You can try in Android sdk Under the path , see tools/monitor Whether there is , It is possible to use even if it exists .
2.1.2、 If the tools provided above are available , There is also a simplified version , Can be directly in tools/bin The lookup uiautomatorviewer The function is the same as the above
Normal is such an effect

And use adb command ,adb The method of command seems to be a headache , No more examples , Specifically, you can search by yourself .
lose the first battle
The above tools have been used more , Just think that solving this problem is a matter of minutes . I'm still young . tried 2.1.1 Method , And then it failed all the time

At first, I thought it was the wrong tool , Memory caused Just change 2.1.2 Tools for . Not yet. . But an important phenomenon was found If there are few changes on the page , You can grab , Too much is not enough , The combination saves doubt because it is generating view hierarchy When , The live page has changed , Cause build failure .
Don't try decompiling apk?
Do as you say , Use jadx Yes apk decompile ,8g The memory was directly exploded , Reconfigure to 16g, Run normally . Look at the code , Feel headache , Why don't you think of another plan . Have to say , The live page is really a bit of a headache 1、activity Even use a proxy to handle 2、 Used all evil event bus 3、 Confusion and agency of resources As a whole , If you look at this code , It's a headache , It takes more energy .
How about first xp hook Next ?
This seems to cost a lot . As a solution .
Another village
I thought there was no better plan , Then a want to , incorrect , Now that we have used auxiliary functions , Why not consider using api To do it? ? Do as you say . 1、 our service Inherit directly from AccessibilityService Our previous business is also handled in this .
public abstract void onAccessibilityEvent(AccessibilityEvent event);
Focus on AccessibilityEvent There are
public @EventType int getEventType() {
return mEventType;
}
see EventType:
@IntDef(flag = true, prefix = { "TYPE_" }, value = {
TYPE_VIEW_CLICKED,
TYPE_VIEW_LONG_CLICKED,
TYPE_VIEW_SELECTED,
TYPE_VIEW_FOCUSED,
TYPE_VIEW_TEXT_CHANGED,
TYPE_WINDOW_STATE_CHANGED,
TYPE_NOTIFICATION_STATE_CHANGED,
TYPE_VIEW_HOVER_ENTER,
TYPE_VIEW_HOVER_EXIT,
TYPE_TOUCH_EXPLORATION_GESTURE_START,
TYPE_TOUCH_EXPLORATION_GESTURE_END,
TYPE_WINDOW_CONTENT_CHANGED,
TYPE_VIEW_SCROLLED,
TYPE_VIEW_TEXT_SELECTION_CHANGED,
TYPE_ANNOUNCEMENT,
TYPE_VIEW_ACCESSIBILITY_FOCUSED,
TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED,
TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
TYPE_GESTURE_DETECTION_START,
TYPE_GESTURE_DETECTION_END,
TYPE_TOUCH_INTERACTION_START,
TYPE_TOUCH_INTERACTION_END,
TYPE_WINDOWS_CHANGED,
TYPE_VIEW_CONTEXT_CLICKED,
TYPE_ASSIST_READING_CONTEXT
})
@Retention(RetentionPolicy.SOURCE)
public @interface EventType {}
I saw what I was thinking TYPE_VIEW_CLICKED I think I see the light .
2、 Just do it , In terms of code arrangement . Turn on the auxiliary , Trigger corresponding view Click events for . Exciting things happened
It really outputs the corresponding view id and text!!!
3、 Use
findAccessibilityNodeInfosByViewId(String viewId)
Get the corresponding nodeInfo, Then click it .
Originally mundane operation , Unexpectedly, there are waves again .
The waves rise again
Find out about what you found earlier view When clicking , Cannot trigger effect . But this is what I caught when I clicked just now view ah ,text The content is also right , What's going on ? Look at this first view Is it right? clickable Well , What if there is no such function ?
List<AccessibilityAction> getActionList()
nodeInfo Provides the ability to view all of the current node action A list of , It also has corresponding meaning . Among them, we are more concerned about this
public static final int ACTION_CLICK = 0x00000010;
Unfortunately, I found it earlier view There is no such thing action.
The perfect ending
To recall Android The event delivery mechanism , If one view Click events are not blocked , But the click event was also responded , There is only one case -- Current view The parent layout or child layout of handles events . The army is divided into two ways adopt :
getParent()
getChild(i)
Go to check the corresponding parent view Hezi view, And check their corresponding action Is there a click. Everything comes to him who waits . Finally confirmed ,view The parent layout of has click Of action. To the father view To operate , Also achieved the desired effect . So far, this problem has been solved .
Shortcut sorting
1、 utilize AccessibilityService in onAccessibilityEvent Of event Of clicktype, narrow view Search scope for .
2、 check view Is it what you want to confirm view
3、 If necessary view, But unable to respond to events , You can find the parent layout or the child layout that can respond click Of view
4、 Determine what is ultimately to be determined view
5、 Don't be bound by previous experience , You should use the system more api, Think more about the principles of the system .
Official account : arigeweixin , Get more contact

边栏推荐
- onvif協議相關:4.1.3 WS-Username token方式獲取截圖url
- onvif协议相关:常用类说明
- 弹性负载均衡将访问流量自动分发到多台云服务器,扩展应用系统对外的服务能力,提高应用程序安全性。
- 【码蹄集新手村 600 题】科学计数法的实现方式,输出指数形式
- Responsive Zhimeng template logistics and freight service website
- [error record /selectpicker] the display position of dropdown menu is offset
- Onvif protocol related: 3.1.4 get the stream address in digest mode
- How to upgrade Flink job gracefully?
- 如何在MFC中添加一个线程
- Galaxy Kirin V10 arm offline installation of portal
猜你喜欢

Onvif protocol related: 2.1.3 get the stream address in none mode

Attachment handling of SAP Fiori

Panasonic A6 servo driver external absolute value grating ruler full closed loop parameter setting

VMware imports ova/ovf virtual machine files

LeetCode 0117. 填充每个节点的下一个右侧节点指针 II

【腾讯蓝鲸】第七届 7·24 运维日节日祝福送上~ 快来许愿~

Weekly summary (*65): planned output

Using the case statement will produce a latch condition

Module 7 (Architecture Design of King glory mall)
![Codeforce:a. difference operations [mathematical thinking]](/img/be/28bcb5dd8b9a36f2955f1912f289a3.png)
Codeforce:a. difference operations [mathematical thinking]
随机推荐
Atmospheric non isohalo effect
【腾讯蓝鲸】第七届 7·24 运维日节日祝福送上~ 快来许愿~
云审计服务CTS是一项付费服务,付费项目包括开通追踪器、事件跟踪以及7天内事件的存储和检索等相关费用
How to upgrade Flink job gracefully?
【7.9】代码源 -【选数】【序列操作】【Minimum Or Spanning Tree】
onvif協議相關:4.1.3 WS-Username token方式獲取截圖url
STM32F1与STM32CubeIDE编程实例-MPU-6050 六轴(陀螺仪 + 加速度计)驱动
[pumpkin Book ml] (task2) mathematical derivation of linear model (least squares estimation, generalized Rayleigh quotient, maximum likelihood estimation, etc.)
[try to hack] ARP and ARP deception
perl 命令批量替换文件中的一些内容
Onvif protocol related: 4.1.2 WS username token method to obtain token
Method of converting video format to ffmpeg and exporting GIF dynamic graph
【7.12】Codeforces Round #806 (Div. 4)
CMOS switch learning (I)
AcWing 257. Explanation of prisoner detention (bipartite picture)
MySQL sort index failure?
codeforce:A. Doremy‘s IQ【反向贪心】
JVM self study summary
模板虚拟机环境准备
ArrayList underlying analysis