是否可以使用语音触发器的输入提示为用户提供“提示”?这类似于显示“拨打电话”的操作,为您提供可能的选项列表。
例如使用以下内容......
<trigger keyword="@string/start_scan" >
<constraints
camera="true"
network="true" />
<input prompt="@string/prompt_scan_what" />
</trigger>
我希望用户流程如下......
------------
"Ok, Glass"
------------
"Scan"
------------
What would you like to scan?
QR Code
Product
Barcode
------------
"Barcode"
答案 0 :(得分:1)
找到一个有一些缺点的解决方法:
工作流更像是......
---------
"Ok, Glass"
---------
"Scan"
---------
ok glass, scan...
QR Code
Product
Barcode
---------
"Barcode"
Android Manifest:
<activity android:name="com.cantilsoftware.barcodeeye.LaunchActivity">
</activity>
<activity-alias
android:name="Product"
android:label="Product"
android:targetActivity="com.cantilsoftware.barcodeeye.LaunchActivity" >
<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/voice_trigger_scan" />
</activity-alias>
<activity-alias
android:name="Barcode"
android:label="Barcode"
android:targetActivity="com.cantilsoftware.barcodeeye.LaunchActivity" >
<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/voice_trigger_scan" />
</activity-alias>
<activity-alias
android:name="QR Code"
android:label="QR Code"
android:targetActivity="com.cantilsoftware.barcodeeye.LaunchActivity" >
<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/voice_trigger_scan" />
</activity-alias>
选择检测:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launch);
try {
ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(), 0);
processVoiceAction(activityInfo.loadLabel(getPackageManager()).toString());
} catch (NameNotFoundException e) {
e.printStackTrace();
processVoiceAction(null);
}
}
答案 1 :(得分:0)
您是否尝试在提示文字中的问号后添加换行符(即'/ n')以获得新的新行?