245 words
1 minutes
Accessibility
find the ❌ element, say this button.
use Android Device Monitor in Android studio. Click this one
move your mouse and click on the button you want to know its resource-id, then you can find this element via its id
this tool is from AS, some high versions don’t have this tool
recommend as version:
https://developer.android.google.cn/studio/archive
Android Studio Arctic Fox | 2020.3.1 Patch 2 September 1, 2021
Windows (64-bit): android-studio-2020.3.1.24-windows.exe (957.2 MB)
Mac (Intel): android-studio-2020.3.1.24-mac.zip (997.2 MB)
Mac (Apple silicon): android-studio-2020.3.1.24-mac_arm.dmg (993.3 MB)
其他airtest
https://airtest-new.nie.netease.com/update/airtestide
start to code
AndroidManifest.xml
name should be the same with java file name
<!-- register accessibility service -->
<service
android:name=".LuckyAccessibilityService"
android:enabled="true"
android:exported="true"
android:label="little shit"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
<intent-filter>
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data
android:name="android.accessibilityservice"
android:resource="@xml/accessibility_config" />
</service>
<!-- register accessibility service -->
xml/accessibility_config
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeAllMask"
android:accessibilityFeedbackType="feedbackSpoken"
android:accessibilityFlags="flagIncludeNotImportantViews|flagReportViewIds"
android:canPerformGestures="true"
android:canRetrieveWindowContent="true"
android:description="@string/accessibility_desc" // heres the strings
android:notificationTimeout="100" />
values/strings.xml
: show the name on Accessibility - Downloaded services
<resources>
<string name="app_name">AutoDemo</string>
<string name="accessibility_desc"> fuck fuck fuck 开麦打游戏的人拉屎没纸</string>
</resources>
懒得记了,后续请看
tips
monitor无法解析正在播放视频的画面,可使用手机“界面分析”app或电脑平替
点第二个解析页面
Accessibility
https://zycreverse.netlify.app/posts/accessibility/