本文介绍了如何知道 Android TalkBack 是否处于活动状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,该应用程序使用 TalkBack 来指导人们完成它.但是,在这些情况下,我希望在应用程序的布局中有一些细微的差异,以便导航更容易,并且还有额外的语音输出(使用 TextToSpeech)来帮助指导用户.

I'm developing an application that uses TalkBack to guide people through it. However, in those situations I want to have some subtile differences in the layout of the application so navigation is easier and also have extra voice outputs (with TextToSpeech) to help guide the user.

我的问题是,如果用户启用 TalkBack,我只想要这些更改和额外的输出.

My problem is that I only want those changes and extra outputs if the user has TalkBack active.

有没有办法知道它是否存在?我没有找到任何特定于直接访问 TalkBack 设置的内容,但我希望有某种访问通用电话设置的形式可以让我知道我需要什么.

Is there any way to know if it is? I didn't find anything specific to access TalkBack settings directly, but I was hoping there was some form of accessing general phone settings that could let me know what I need.

提前致以问候和感谢.

推荐答案

例如,查看 (通过群组线程).

For an example, look at isScreenReaderActive() in HomeLauncher.java file in the Eyes-Free shell application (via groups thread).

总而言之:您检测所有带有 Intent 的屏幕阅读器,然后查询每个屏幕阅读器的状态提供程序以查看其是否处于活动状态.

To sum up: you detect all screen readers with Intents, then query the status provider of each to see if it is active.

如果您真的想将其限制为仅使用 TalkBack,您可以尝试检查 ResolveInfo.serviceInfo.packageNamequeryIntentServices() 返回的每个结果,看看它是否匹配 TalkBack 包.

If you really want to limit it to TalkBack only, you could try checking the ResolveInfo.serviceInfo.packageName for each result returned from queryIntentServices() to see if it matches the TalkBack package.

这篇关于如何知道 Android TalkBack 是否处于活动状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-07 23:53