3

I am currently writing an app that needs to be able to play audio. As i want the audio to continue playing when the user leaves the app, i am using an IntentService to handle the play method.

My problem is that i need to be able to update the applications UI, such as a progress bar showing how much is remaining of the audio, using data from the intentservice.

I was just wondering what the best way of achieving this would be? I have googled this, but all the guides seem to be for AsyncTask or just standard services.

Thanks heaps to anyone who can help.

Cheers Corey

Fishingfon
  • 1,034
  • 3
  • 19
  • 33

2 Answers2

6

Use a Handler and Messenger class.

Someone already post a good answer here (its also use Handler and Messenger) :

How to Collect info from IntentService and Update Android UI

Community
  • 1
  • 1
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129
0

We can even use Local Broadcast for this purpose.Please refer below link.

How to Collect info from IntentService and Update Android UI

Tarun Anchala
  • 2,232
  • 16
  • 15
  • 1
    Most of your post is the same link as in the existing, upvoted and accepted answer. Please consider making your additional contribution more obvious. – Yunnosch Oct 23 '20 at 08:13