我正在尝试使用google now语音命令搜索我的应用,例如:"在APP_NAME上搜索内容"。
我正在将它用于我的应用程序Pluto(https://play.google.com/store/apps/details?id=com.tamal.voicesearch)。 现在问题是这个语音搜索工作2周后(对于我的其他应用程序)。现在它不能在我的某些设备中工作,但在某些设备中它正在工作。更有趣的是,在所有这些设备中,语音搜索适用于像Flipkart这样的应用程序。
一个奇怪的解决方案:
我花了整整一天研究这个问题,然后清除了我的Google应用程序的数据并卸载了更新,突然它开始使用我的Samsung S4设备(Android版本:5.0.1和Google App版本7.8.22.21 ),请检查附件。 但在我的其他2台设备Moto G4(Android版本:7.0.0)和Nexus 5(Android版本:6.0.1)中,它仍无法正常工作(即使在清除数据和卸载Google App的更新后)。如果我说"在Pluto"上搜索某些内容,它就会进行网络搜索。
我已经研究过,但尚未对此行为做出任何解释或解决方案。根本不理解这种不一致。我正在使用以下文档:
https://developer.android.com/guide/components/intents-common.html#Search https://www.youtube.com/watch?v=PS1FbB5qWEI
我的代码非常简单..清单中的以下内容..
<activity android:name=".SearchableActivity">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.VOICE" />
</intent-filter>
</activity>
在Activity中获取查询字符串..
if (intent != null && ACTION_VOICE_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
}
并且
compileSdkVersion 26
请帮忙。
三星S4中的工作屏幕
在Moto G4中没有工作的屏幕截图