It has been pretty difficult to track down information on interacting
with the Amazon MP3 application. After a bit of poking around, it
appears the app provides a way to handle external intents through a
proxy activity. There are two mechanisms for accessing the Amazon MP3
search service. Here are a few code snippits to demonstrate how to set
up the intent object using both methods.

The first implementation appears to be geared to handle searches based
on the MediaStore constants and responds to the
INTENT_ACTION_MEDIA_SEARCH action.

Intent i = new Intent();
String query = "SEARCH TERMS";
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setClassName("com.amazon.mp3",
"com.amazon.mp3.activity.IntentProxyActivity");
i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
i.putExtra(MediaStore.EXTRA_MEDIA_TITLE, query);

A more interesting way to accomplish the same thing is using the
EXTERNAL_EVENT action. This is the mechanism used by the Shazam app.

Intent i = new Intent();
String query = "SEARCH TERMS";
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setClassName("com.amazon.mp3",
"com.amazon.mp3.activity.IntentProxyActivity");
i.setAction("com.amazon.mp3.action.EXTERNAL_EVENT");
i.putExtra("com.amazon.mp3.extra.EXTERNAL_EVENT_TYPE","com.amazon.mp3.type.SEARCH");
i.putExtra("com.amazon.mp3.extra.SEARCH_TYPE", 0); // 0 = Song, 1 =
album
i.putExtra("com.amazon.mp3.extra.SEARCH_STRING", query);

Both of these do essentially the same thing. The EXTERNAL_EVENT action
has several other EXTERNAL_EVENT_TYPE values to launch other features.
Here's a quick rundown of the fields

extra: "com.amazon.mp3.type.SEARCH"
     (uses) extra: "com.amazon.mp3.extra.SEARCH_STRING"
     (uses) extra: "com.amazon.mp3.extra.SEARCH_TYPE"

extra: "com.amazon.mp3.type.SHOW_ALBUM_DETAIL"
    (uses) extra: "com.amazon.mp3.extra.ALBUM_ASIN"

extra: "com.amazon.mp3.type.GENRE_BROWSE"
     (uses) extra: "com.amazon.mp3.extra.BROWSE_TYPE"
     (uses) extra: "com.amazon.mp3.extra.GENRE_NAME"

extra: "com.amazon.mp3.type.TOP_MUSIC_BROWSE"
     (uses) extra: "com.amazon.mp3.extra.BROWSE_TYPE"

there does not appear to be any way to indicate an associate ID.
However, the Amazon system does log the package initiating the search.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to