简体   繁体   English

我需要将我的语音搜索应用程序添加到 Android 中的“使用完成操作”

[英]I need to add my Voice Search app to “Complete action using” in Android

I can't seem to be able to find any example of how to add my own program (voice control) to a “Complete action using” list, on search button press.我似乎无法找到任何示例,说明如何在按下搜索按钮时将我自己的程序(语音控制)添加到“使用完整操作”列表中。

Right now, when you press the search button on your device, Google Voice Search will activate.现在,当您按下设备上的搜索按钮时,Google 语音搜索就会激活。 I need to add here my own software, so end user has a choice of using either Google Voice Search or my own app.我需要在此处添加我自己的软件,以便最终用户可以选择使用 Google 语音搜索或我自己的应用程序。

Something like this example illustrates: http://support.launcherpro.com/images/complete%20action%20using%20lp_2.png , but I need the code example (intent) for the voice search action in particular.类似这个例子的东西说明了: http://support.launcherpro.com/images/complete%20action%20using%20lp_2.png ,但我特别需要语音搜索操作的代码示例(意图)。

So again, I want to map my application to "Complete Action Using" list, when person presses the search button.再次,当人们按下搜索按钮时,我想将我的应用程序映射到“使用完整操作”列表。 Search button on the device itself, not in my application.设备本身上的搜索按钮,而不是我的应用程序中。

I have found this code (which maps specific app to menu when .doc file is opened), but how do I amend it, so it adds my app to list on search button long press?我找到了这个代码(它在打开 .doc 文件时将特定的应用程序映射到菜单),但是我该如何修改它,以便将我的应用程序添加到长按搜索按钮上的列表中?

      <activity android:name="ActivityTest" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http" />
            <data android:pathPattern=".*doc" />
        </intent-filter>
     </activity>

Use this intent : RecognizerIntent.ACTION_RECOGNIZE_SPEECH Here is the sample code on how it works.使用这个意图: RecognizerIntent.ACTION_RECOGNIZE_SPEECH 这是它如何工作的示例代码。

// Check to see if a recognition activity is present
PackageManager pm = getPackageManager();
List activities = pm.queryIntentActivities(
  new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() != 0) {
  speakButton.setOnClickListener(this);
} else {
  speakButton.setEnabled(false);
  speakButton.setText("Recognizer not present");
}

http://developer.android.com/resources/articles/speech-input.html http://developer.android.com/resources/articles/speech-input.html

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

相关问题 我需要将Android带有蓝牙耳机的语音搜索应用添加到“使用中完成操作” - I need to add my Voice Search app to “Complete action using” in Android with Bluetooth headset “使用完整操作”发送未在Android中显示我的应用的短信 - “Complete action using” to send SMS not showing my app in android Android - 语音搜索应用? - Android - Voice search app? 阻止在我的应用中使用“完整操作”? - prevent “complete action using” in my app? Android完成动作使用 - Android Complete Action Using 如何通过“使用完成操作”和“共享通过”菜单截取所有链接并定向到我的Android应用程序? - How to intercept all links and direct to my Android app, via both the “complete action using” and “share via” menus? 向Android应用添加语音命令 - Add voice commands to Android app 当用户选择一首歌曲&gt;使用对话框完成动作&gt;在我的应用中时,如何获取歌曲详细信息 - how can i get song details, when user chooses a song>complete action using dialog> into my app 通过Google Voice Actions搜索操作过滤列表时,Android应用程序崩溃 - Android app crashes when filtering list via Google Voice Actions search action 无法在Android可穿戴式应用中注册语音操作 - Cannot register voice action in Android wearable app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM