Tapa Save
Tapa Save

Reputation: 4857

How pass variables from activity to service without restart service

I need send data (ArrayList, Array, String, etc) from my Activity to my Service. If use Intent and Bundle nesessary Service restart. I need send data without restart Service (if Service is running use him, if not running start him and send new data).

Also I need same send data from BroadcastReceiver to Service.

What is best practice?

Upvotes: 0

Views: 492

Answers (1)

Android Killer
Android Killer

Reputation: 18509

Use Bind Service for that, it is meant for communication between service and other component.

Example

Upvotes: 1

Related Questions