0

Right now I'm using

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://music"));
startActivity(intent);

to launch the music store in the android market which seems to crash. Also how could I include a search string in this. If it is even possible that is.

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
ghostbust555
  • 1,930
  • 14
  • 27

3 Answers3

1

Do you want to launch Market at the Google Music application?

If so, you can use this code:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("market://details?id=com.google.android.music"));
startActivity(i);

Edit: ... Or are you trying to launch Market at the Music section? I don't think it's possible. Also, many users can't access the Music store in Market, so it won't work for those users (which is basically anyone outside the US).

Michell Bak
  • 12,857
  • 11
  • 60
  • 121
  • Actually thats not what I meant but that is very interesting, is there a way to see if google music is installed or not before launching the intent? What I meant however was when you first open the market on android there are now three options: apps, music, and books. I want it to take you to where you would be if you clicked on music – ghostbust555 Mar 05 '12 at 23:35
  • Please see my updated answer. Regarding a way to see if an app is installed, you can refer to this question: http://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run – Michell Bak Mar 05 '12 at 23:36
  • Google music is also only available in the U.S btw – ghostbust555 Mar 05 '12 at 23:45
  • I just noticed that in google music ap you can click an icon and it takes you to the music section of the market so this is possible – ghostbust555 Mar 06 '12 at 00:58
  • Hmm, I don't see that. Where's the icon? – Michell Bak Mar 06 '12 at 08:48
  • Int the bottom right next to the search button there is a market logo which takes you to the music section. Is google music open source? – ghostbust555 Mar 06 '12 at 14:42
  • Hmm, doesn't appear on my Music app. Must be because I'm outside the US. I'm afraid I don't know if it's open source or not, but I don't think so. – Michell Bak Mar 06 '12 at 16:16
0

If you want to launch the market in music mode, try using https://market.android.com/music. If you want to do search for specific music, try https://market.android.com/search?q=sting&c=music

Franci Penov
  • 71,783
  • 15
  • 124
  • 160
  • This is a last resort option, the website is not formatted for mobile and is very hard to navigate on a small screen – ghostbust555 Mar 06 '12 at 01:04
  • The reason I asked you if you tried these is that ideally, the Android Market app should be intercepting the `https://market.android.com` URLs. In general, `https://market.android.com/music` should be equal to `market://music`. (On a side note, if that's implemented properly, it'll likely lead to the same crash. :-/) – Franci Penov Mar 06 '12 at 20:34
0

I finally found this somewhere on the net and it works!

public void buyMusic(View v){
     Uri uri = Uri.parse("market://details?id=album-Bbeyjqldhuyoda7byal4op4he2u");
     Intent it = new Intent(Intent.ACTION_VIEW, uri);
     startActivity(it);
}
ghostbust555
  • 1,930
  • 14
  • 27