适用于Android的Google Play音乐API [英] Google Play Music API for Android

查看:134
本文介绍了适用于Android的Google Play音乐API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Android安装一个音乐应用程序。
我需要两件事:


  • 获取艺术家,专辑名称,曲目名称等的专辑封面;

  • 打开Goog​​le Play页面购买这张专辑。
  • =http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html> iTunes API - 但这不是真正的爱国Android开发人员。如果Google Play音乐有类似的服务,我宁愿使用它。它存在吗?



    第二个呢?我可以使用这段代码根据我的查询显示所有搜索结果:

      Intent intent = new Intent(Intent.ACTION_VIEW)
    .setData(Uri.parse(market:// search?q =< My Query>));
    startActivity(intent);

    但我想要精确显示专辑或跟踪购买页面。 Google Play是否可以使用?

    解决方案

    Google没有官方 API。但是,您可以使用由Simon Weber开发的非官方 API。它被称为非官方 - Google-Music-API ,它似乎是积极维护(截至撰写本文)。

    文档和示例非常简单,您可以找到有关歌曲元数据的详细信息列在这里。具体来说,它提供了一个网址,用于下载封面插图 Play商店中匹配的ID。



    您可能需要尽管如此,您的搜索网址有点儿不合适。例如,您可以使用返回的 albumMatchedId 字段按照以下专辑进行搜索:


    https://play.google.com/store/music/album?id= Bdkf6ywxmrhflvtasnayxlkgpcm


    这会带您进入专辑页面,您可以购买每首歌曲或整张专辑。 p>

    我还没有找到直接跳转到特定轨道的方法,但我不确定这是否可能,从布局判断的应用程序。


    I'm working on a music application for Android. I need two things:

    • Get album cover for artist, album name, track name, etc;
    • Open Google Play page for buying this album.

    For the first thing I'm currently using iTunes API -- but this is not patriotic for true Android developer. If Google Play Music has similar service, I would preferred to use it. Does it exist?

    What about second? I can use this code to show all search results according with my query:

    Intent intent = new Intent(Intent.ACTION_VIEW)
                                 .setData(Uri.parse("market://search?q=<My Query>"));
    startActivity(intent);
    

    But I want to show album or track buying page exactly. Is is possible for Google Play?

    解决方案

    There's no official API for this from Google.

    However, you can use an unofficial API that is being developed by Simon Weber. It's called Unofficial-Google-Music-API, and it seems to be actively maintained(as of this writing).

    The documentation and examples are pretty straightforward, and you can find details about the song's metadata as listed here. Specifically, it gives an url to download cover art and the id for matching in the Play Store.

    You may have to play around with the URL a bit for your search, though. For instance, you can use the returned albumMatchedId field to search by album like:

    https://play.google.com/store/music/album?id=Bdkf6ywxmrhflvtasnayxlkgpcm

    This should bring you to the album's page, where you can purchase each song or the entire album.

    I haven't found a way to jump straight to a specific track, but I'm not sure if that's possible anyway, judging from the layout of the app.

    这篇关于适用于Android的Google Play音乐API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆