adb shell settings put secure enabled_accessibility_services your.package.name/your.accessibility.service adb shell settings put secure accessibility_enabled 1 Let’s say you are using the popular uiautomator library with Python on a rooted/ADB-connected device. You need to enable the UiAutomator test service.
Here is a script that automates opening Instagram and double-tapping the first post (liking it). #!/bin/bash # ADB Enable Automator - Instagram Liker PACKAGE="com.instagram.android" ACTIVITY="com.instagram.mainactivity.MainActivity" adb enable automator
Most automation frameworks on Android rely on the . You cannot grant this permission via a normal app intent, but you can grant it via ADB using the settings or cmd commands. Method 1: The "Accessibility" Approach (Most Common) If your automation script is running via an app (e.g., a Python script using uiautomator or an app like "MacroDroid"), you must enable its accessibility service. You don't need a third-party app
#!/bin/bash adb shell screenrecord /sdcard/bug_replay.mp4 --time-limit 10 & Clear previous logs adb logcat -c Perform automated actions adb shell input swipe 300 1000 300 300 # Swipe down sleep 2 adb shell input tap 540 500 # Tap a button sleep 1 adb shell input keyevent KEYCODE_BACK Stop recording and pull files sleep 12 adb pull /sdcard/bug_replay.mp4 adb logcat -d > bug_logs.txt you can run an automator.
adb shell pm grant your.package.name android.permission.DUMP adb shell pm grant your.package.name android.permission.INJECT_EVENTS Note: INJECT_EVENTS often requires a rooted device or a system app. For non-root, use uiautomator wrapper scripts. Once you have enabled the permissions, you can run an automator. You don't need a third-party app; you can be the automator using pure ADB shell commands.