Search code examples
androidbackground-music

Preferred way to add background music to Android game?


I want to add background music to my Android game, this needs to be pause able, resume able, etc.

I have found this example: http://www.codeproject.com/Articles/258176/Adding-Background-Music-to-Android-App

However the line

mServ = ((MusicService.ServiceBinderbinder).getService();

Seems to kick up really weird errors, I have no idea what this is trying to do..

If anyone can see how to get this way working or if there is another, better way of doing this?


Solution

  • After extensive looking, I have found this other question: Playing BG Music Across Activities in Android

    Which points to this code: http://www.rbgrn.net/content/307-light-racer-20-days-61-64-completion

    Which seems to work fine. Not sure if this is the best way..