Rabu, 15 September 2010

Supporting the new music Voice Action

Jika anda baru pertama kali berkunjung ke blog ini, Silakan kasih Komentar untuk artikel yang anda baca.

[This place is by Mike LeBeau, the Tech Lead and architect behindhand Voice Actions. Tim Bray]

We recently launched Voice Actions in the newborn Google Voice Search for Android — an awing newborn artefact to search, control, and transmit on your phone faster than ever before, by using your voice.

One of these newborn Voice Actions lets users encounter and automatically endeavor music. By speech something same listen to They Might Be Giants into the newborn Voice Search, users crapper apace encounter the penalization they poverty online and endeavor it, using some number of assorted apps. (Pandora, Last.fm, Spotify, mSpot, and Rdio are among the first apps to hold this.)

To do this, we leveraged a very common lowercase example of Android magic: a newborn Intent. If you amend a penalization app that supports open-ended penalization search, you crapper attain it impact with users speech listen to Voice Actions simply by registering for the newborn aim weve defined. This newborn aim isnt circumscribed as a unceasing in the SDK yet, but we wanted to attain trusty penalization app developers had all the information needed to ingest it right away.

Heres all you should requirement to know:

  • In your AndroidManifest.xml, just run one of your activities for the newborn aim android.media.action.MEDIA_PLAY_FROM_SEARCH:

    <application android:label="@string/app_name" android:icon="@drawable/icon"> <activity android:name="MusicActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity></application>
  • When your state receives this intent, you crapper encounter the users see ask inside the SearchManager.QUERY progress extra:

    import android.app.Activity;import android.app.SearchManager;public class MusicActivity extends Activity { @Override open vacuum onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String ask = getIntent().getStringExtra(SearchManager.QUERY); // Do something with query... }}

    This module equal everything the user crosspiece after listen to. This is totally open-ended vocalise recognition, and it expects very flexible search — so, for example, the progress could be the study of some creator (they strength be giants), an album (factory showroom), a strain (metal detector), or a combination of some of these (metal detector by they strength be giants).

A few impalpable details worth discernment about this intent:

  • Your app should do its prizewinning to apace encounter and automatically endeavor penalization corresponding to the users see query. The intention here is to get users to their desirable termination as alacritous as possible, and in this case, that effectuation playing penalization quickly.

  • This module really exclusive impact substantially for penalization apps that crapper encounter penalization across a very super capital of options. Because our vocalise acceptance doesnt currently hold some artefact to wage a list of specific songs to be recognized, disagreeable to ingest it against a diminutive ordered of penalization choices module impact poorly — things which are not in the ordered module be over-recognized, and things which are in the ordered may not be constituted well. So if youre not the developer of a large-scale cloud penalization application, this aim is probably not for you.

We conceive youll encounter this newborn aim crapper greatly enhance your penalization apps experience for users. And we wish you enjoy our newborn Voice Actions as much as we do!


Thanks
basyar.com

Tidak ada komentar:

Posting Komentar