I have written my own AccessibilityService
for my app. Internally it uses TextToSpeech
to provide spoken feedback for the users navigating through my app. When both TalkBack
and MyAccessibilityService
is turned I am getting spoken feedback from my app followed by TalkBack's feedback.
Is there any way to stop TalkBack for my app as I own a accessibility service for my app?
I was dealing with this and I managed to solve it doing this.
You have to make your service take charge of the accessibility of your app, for that in the manifest you have to add this:
<service android:name="communication_interfaces.MyAccessibilityService"
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/serviceconfig" />
</service>
then in serviceconfig
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeAllMask"
android:packageNames="com.packagename"
android:accessibilityFeedbackType="feedbackSpoken|feedbackHaptic|feedbackAudible|feedbackGeneric"
android:notificationTimeout="100"
android:settingsActivity="com.myActivity"
android:canRetrieveWindowContent="true"
android:description="@string/service_description"/>
thats it, remember if your are doing this, you dont need to override onServiceConnected().
/*@Override
protected void onServiceConnected()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.