fergaral
fergaral

Reputation: 2097

Android - Passing variables to an already running IntentService

I have an IntentService which does some image processing. In my Activity, I have a cancel button which needs to send a message to the service (a boolean value) so that it should stop when it has finished processing the current image.

I know I can pass values to a service before calling startService() via the intent.putExtra() method. But in this case, I need to send the boolean variable to the IntentService while it's running.

How can I do this?

Thank you.

Upvotes: 0

Views: 599

Answers (1)

suresh
suresh

Reputation: 266

Use Broadcasts, register a broadcast receiver in your service and send broadcast from your activity to the service.

Upvotes: 1

Related Questions