Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6171299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:11:18+00:00 2026-05-23T23:11:18+00:00

I am working on media play app based on this example: How to design

  • 0

I am working on media play app based on this example: How to design activity-service interaction for a simple mp3 player?

It works fine, but I am unsure of how to request data from the service on demand. Specifically, I want to update a progress bar with the position of the song so the service should be able to give that information back to the client activity. The update should happen once a second.

Since it is only on demand (ie. only when the activity is visible) a broadcast would probably not be the solution.

So from what I know so far, I could either use a Messenger or I could bind the service.

What would be the most appropriate in the given situation, ie. with an update frequence of 1 second?

Addition:

As far as I know, the service will stop with the activity when it’s bound. This is of course not what I want with a music player. I have therefore tried both binding the service and sending commands with an intent using startService(). This seems to work fine, but is it a sensible approach? The reason I do this is that the service will keep on living after the activity stops when started by startService.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:11:18+00:00Added an answer on May 23, 2026 at 11:11 pm

    If you are looking for some guidelines for implementing music player the best place is to check android’s default Music Player source.

    And for your question i think the proper way is to bind your activity to the service and keep the reference to service. Than simply start a timer in your activity and ask the service for current progress every second.

    Addition:
    Check again the source code. You’ll notice that when all activities are unbind from the service there is check if there is something to play. If there is something to play the service is not stopped and the playback continues otherwise the service is stopped ( to free it resources and wait for the time when it’s needed again). To see the above implemented in real life check the MusicPlaybackService‘s method onUnbind().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Browser-based media player which is written almost entirely in
I am working on a media player for an example application... and things are
Hopefully I can articulate this problem well. I'm working on a simple audio player
hi i have create one simple media player.... now its working fine. i retrieve
I'm working on a simple mp3 player project with C# and the WMPLib library.
I working on a distributed mediaplayer that uses the windows media player component. Now
I'm working on a media streaming app, and noticing some odd behavior. Media stops
So I've been working on a soundboard app for my kids. This is my
I want to play video in WP7. This is my code: MediaPlayerLauncher player =
I am currently working on media player. When I am clicking the next button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.