Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Mar 2014
    Post Thanks / Like
    15 Post(s)

    Cannot play mp3 in the background with a service

    Hello everybody ,
    I have a playlist, I wanted it playing in the background with a service. However, I do not understand why it was played 4-5 songs is stop. though service is still running, not killed. I have also used a variety of ways such as: Wifilock, WakeLock, .. but still no results. I thought it was stopped due to not wake Wifi / 3G in battery saving mode. I tried to run the examples here (, but the result still same above.
    .Hope everybody help please.

  2. #2
    Member damponting44's Avatar
    Join Date
    Sep 2016
    Post Thanks / Like
    0 Post(s)
    The solution: it needs to be written like this: MediaPlayer p = Mediaplayer.create(this, filename) because p.create will call the static method, and it will return a new instance of a MediaPlayer, which is never stored. Then, I called start() on the default-constructed instance, that is why it was not working.

  3. #3
    Join Date
    Sep 2016
    Post Thanks / Like
    2 Post(s)
    Few steps to follow.....

    1.First go through the service examples.

    2.From this activity start a service ie., whenever this app opened navigate activity to service the activity----> service.

    3.In service override onstart().

    4.In onstart() create musicplayer function and cal the song you want.

    5.And start like this;

    6.Now it will run on background

Similar Threads

  1. Replies: 2
    Last Post: 2015-10-14, 09:28 PM
  2. Old Admob with update Google play service
    By anassdotcom in forum Bug Fixing / Testing
    Replies: 2
    Last Post: 2015-03-08, 08:54 PM
  3. Google Play Account Creation Service
    By ramzixp in forum Buy / Sell
    Replies: 1
    Last Post: 2014-12-06, 02:33 PM
  4. amazon with google play service
    By revadata in forum Android Development
    Replies: 3
    Last Post: 2014-08-14, 08:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts