2012-05-02 91 views
4

我使用此URI来搜索Play商店,但Android docs未提及搜索特定类别(例如游戏,音乐或书籍)的方式。搜索特定的Play商店类别

URI marketUri = Uri.parse("market://search?q= "); 

Play图书播放音乐应用程式都打开Play商店应用他们正确的类别,因此,如果他们可以开到特定CATERGORY,那么我想我可以搜索一个。有没有人有这样做的一些信息?

回答

6

我找到了解决方案。以下是我用于购买音乐类别的当前方法。

public static void shopFor(Context context, String artistName) { 
    String str = "https://market.android.com/search?q=%s&c=music&featured=MUSIC_STORE_SEARCH"; 
    Intent shopIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(str, Uri.encode(artistName)))); 
    shopIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    shopIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); 
    context.startActivity(shopIntent); 
}