简体   繁体   English

Android辅助功能服务绕过Android TalkBack

[英]Android accessibility service to bypass Android TalkBack

I have written my own AccessibilityService for my app. 我已经为我的应用编写了自己的AccessibilityService Internally it uses TextToSpeech to provide spoken feedback for the users navigating through my app. 在内部,它使用TextToSpeech为浏览我的应用程序的用户提供语音反馈。 When both TalkBack and MyAccessibilityService is turned I am getting spoken feedback from my app followed by TalkBack's feedback. 同时TalkBackMyAccessibilityService时,我将从应用程序中收到语音反馈,然后是TalkBack的反馈。

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(). 就是这样,请记住,如果您正在执行此操作,则无需覆盖onServiceConnected()。

/*@Override
        protected void onServiceConnected()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM