0

How can I control Spotify (for example) music from a different app (the one I'm making) and pull information such as playlist and track currently playing? (Android)

  • I want to build a prototype app to control spotify's MusicPlayer (play, pause, next, previous, etc) and also to pull the information of the current track that is playing and the playlist with all the songs that are currently in queue.

  • I tried using the AudioManager, but that only worked for the default android media player. (it play/pause the devices media player but it doesn't work with spotify or 3rd party apps)

  • Control the default music player of android or any other music player << Tried this

  • After that, I tried using the code on the 2nd best answer of this post, and it also only worked for the Android default music player.

  • I also found Spotify's Android BETA API's but they say you shouldn't use them for comercial use.

What suggestions can you guys give me?

Right now I am just trying to prototype it by creating a button to play/pause the music that is currently playing by spotify.

Testing on Android 4.4 Samsung GS5

Community
  • 1
  • 1
Tomas
  • 27
  • 2

1 Answers1

2

I think going through Spotify's Android BETA API's is the way to go if you want the spotify specific features (playlist, radios, user info, ...).

The non commercial use probably means that you need to contact them and negotiate a right to use if you plan on selling your app using their APIs. Keep in mind that it is still a Beta API so thing might change, thus you might have to modify your app.

If you just want to get the title and artist of the song, and be able to control "play", "pause", "next", ... Then yes you might be able to go around controlling the default music player.

Distwo
  • 11,569
  • 8
  • 42
  • 65
  • It would be ideal to manage any 3rd party Music Player (app) that the user is using, so if there is a way to do it without the Spotify API's that would be great. If there is a way to get an instance of the running MediaPlayer (android class) that would be great. Thanks – Tomas Oct 08 '14 at 22:56