Playing BG Music Across Activities in Android

You can also create a service which play music using mediaplayer as below. Intent svc=new Intent(this, BackgroundSoundService.class); startService(svc); //OR stopService(svc); public class BackgroundSoundService extends Service { private static final String TAG = null; MediaPlayer player; public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { super.onCreate(); player = MediaPlayer.create(this, R.raw.idil); player.setLooping(true); // … Read more

Android background music service

Do it without service https://web.archive.org/web/20181116173307/http://www.rbgrn.net/content/307-light-racer-20-days-61-64-completion If you are so serious about doing it with services using mediaplayer Intent svc=new Intent(this, BackgroundSoundService.class); startService(svc); public class BackgroundSoundService extends Service { private static final String TAG = null; MediaPlayer player; public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { super.onCreate(); player = MediaPlayer.create(this, R.raw.idil); … Read more