简体   繁体   中英

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?

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

Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM