Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

红包页面getRootInActiveWindow为null #1

Open
YummyLau opened this issue Jan 31, 2018 · 12 comments
Open

红包页面getRootInActiveWindow为null #1

YummyLau opened this issue Jan 31, 2018 · 12 comments

Comments

@YummyLau
Copy link

请教下,如题,有什么解决的方案吗

@YahengWang
Copy link

private void getLuckMoney(AccessibilityNodeInfo rootEvent) throws InterruptedException {
    Log.e("test", "收到红包界面----->3");
    AccessibilityNodeInfo rowNode = getRootInActiveWindow();
    if (rowNode == null) {
        Log.e("test", "noteInfo is null");
        Thread.sleep(delayTime);
        performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
        return ;
    }
    Log.e("test", "收到红包界面----->4");
    List<AccessibilityNodeInfo> openList = rowNode.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/c2i");
    rowNode.recycle();
    for (AccessibilityNodeInfo item : openList) {
        Log.e("test",item.getClassName().toString());
        //item.performAction(AccessibilityNodeInfo.ACTION_CLICK);
    }

xml的配置如下:

捕获不到button,点击home键,再次进入微信就能捕获到?这是为何?

@sinawangnan7
Copy link

我也发现这个问题了,Android 6.0之前版本的手机没问题。在Android 7.0 和 Android 8.1上测试时发现,没当窗口发生改变时getRootInActiveWindow就变成了null,百度+谷歌了半天也没查到解决办法。

@NB-Dragon
Copy link

@sinawangnan7 I have the same problem.In the Activity of "com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyReceiveUI" ,the method of "getRootInActiveWindow()" return null.

@ymxh
Copy link

ymxh commented Jan 25, 2019

一直试都是获取为空,使用getWindows()方法也是为空,真是无解。

@YummyLau
Copy link
Author

如果大家还感兴趣,最近用kotlin尝试写了下只支持微信7.0版本的红包插件。后续会继续优化。
https://github.com/YummyLau/KotlinLearn/tree/master/wxrp
@YahengWang @sinawangnan7 @NB-Dragon @ymxh

@NB-Dragon
Copy link

@YummyLau It's OK. I have found an other way to solve it, which you can see the application in NB-Dragon/RedPacketPolice. There is no source code there.

@YummyLau
Copy link
Author

@NB-Dragon thx!Did it adpter to wechat7.0 ?

@NB-Dragon
Copy link

@YummyLau Not yet, but it's easy to adapt it if i want.

@jp1017
Copy link

jp1017 commented May 28, 2019

如果大家还感兴趣,最近用kotlin尝试写了下只支持微信7.0版本的红包插件。后续会继续优化。
https://github.com/YummyLau/KotlinLearn/tree/master/wxrp
@YahengWang @sinawangnan7 @NB-Dragon @ymxh

找不到啦

@jp1017
Copy link

jp1017 commented May 28, 2019

@YummyLau Not yet, but it's easy to adapt it if i want.

code?

@NB-Dragon
Copy link

@YummyLau Not yet, but it's easy to adapt it if i want.

code?

I won't give you the code, but i will offer you a tip "dispatchGesture".

@YummyLau
Copy link
Author

@jp
https://github.com/YummyLau/WechatTools 项目被我迁移到这里了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants