Saturday, April 10, 2010

Linking to an iTunes search via an app

In many of the radio station apps I've developed, the station wants a way for the listener to choose to buy on iTunes the current playing song. Since most stations don't provide the iTunes ID of the song as part of the "Now Playing" information, the best option I've been able to come up with is to have the app launch iTunes using a searching string.

For example, suppose the station was playing the song by the Talking Heads, called "And She Was". A station might simply provide this as "Talking Heads - And She Was" without any indication of who the artist is and what the song title is (other than what may, or may not be correctly inferred from the dash). Performing an iTunes search, this doesn't really matter.

You can use a URL like the following to do a blanket search on iTunes:

Simply launch this URL from within your app and iTunes will automatically launch and perform the requested search.

This will work on both iPhone and iPad. Please note: if you omit the "media=all" term, the search will return on error on the iPad.

You aren't limited to searching for music. You could also do a search for movies, or apps, etc.

All content copyright © 2009  Brian Stormont, unless otherwise noted.   All rights reserved.