Puneeth Manyam
Puneeth Manyam

Reputation: 81

Talkback is not getting enabled through adb shell

I've tried the command adb shell settings put secure enabled_accessibility_services com.android.talkback/com.google.android.marvin.talkback.TalkBackService to enable talkback from adb shell. It's toggling the ui button which signifies the status of talkback, but talkback is not actually getting enabled. I am trying to enable talkback programmatically for android 6.0. Is there any other way thorough which I can enable it?

Upvotes: 8

Views: 8117

Answers (4)

afollestad
afollestad

Reputation: 2934

Expanding on other answers, I put this in my ~/.zshrc:

function toggleTalkback() {
  output=$(adb shell settings get secure enabled_accessibility_services)
  if [[ "$output" != "com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService" ]]; then
    echo "Talkback on…"
    adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService
  else
    echo "Talkback off…"
    adb shell settings put secure enabled_accessibility_services com.android.talkback/com.google.android.marvin.talkback.TalkBackService
  fi
}

Upvotes: 0

Simon Featherstone
Simon Featherstone

Reputation: 1796

For convenience, I use a shell script to toggle this setting.

output=$(adb shell settings get secure enabled_accessibility_services)

if [[ "$output" == "com.android.talkback/com.google.android.marvin.talkback.TalkBackService" ]]; then
  adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService
else
  adb shell settings put secure enabled_accessibility_services com.android.talkback/com.google.android.marvin.talkback.TalkBackService
fi

Upvotes: 7

Estevão Lucas
Estevão Lucas

Reputation: 4688

Commands to toggle TalkBack:

// disable
adb shell settings put secure enabled_accessibility_services com.android.talkback/com.google.android.marvin.talkback.TalkBackService

// enable
adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService

Kudos to @zeh

Upvotes: 30

MobA11y
MobA11y

Reputation: 18900

Are you running this alongside any other accessibility services or UI Automation (which utilizes the accessibility APIs)? Accessibility services are only allowed to run one at a time, and attempting otherwise will cause exceptions all over the place. Check LogCat and see if TalkBack is attempting to start up, but throwing exceptions when doing so.

Upvotes: 0

Related Questions