如何拥有多种语音触发一个IntentService /服务? [英] How to have multiple voice triggers for one IntentService/Service?
本文介绍了如何拥有多种语音触发一个IntentService /服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我有1声音触发我的IntentService。
Right now i have 1 voice trigger for my IntentService.
我的清单看起来是这样的:
My manifest looks like this:
<service android:name="HelloIntentService" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/hello_show" />
</service>
我打招呼显示是这样的:
My hello show looks like this:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/show_helloworld_voice_trigger"/>
我想超过1语音触发启动我的服务,然后才能找出语音触发启动它。
I would like to start my service with more than 1 voice trigger and then to be able to find out which voice trigger started it.
这可能吗?
推荐答案
创建多个虚拟的活动,每个国家都有它自己的声音触发。他们每个人都将调用你的真实的活动与一些额外的意图表明使用了哪种触发。
Create multiple "dummy" activities, each with its own voice trigger. Each of them will call your "real" activity with some intent extra indicating which trigger was used.
这篇关于如何拥有多种语音触发一个IntentService /服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文