Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending data from service to activity?

I want to schedulers background service to run a scan method. so the service will update the number of scanned file. how can i handle the case that i closed the app schedulers run the service, the update ui method will crash and stop running the service.

like image 294
Basbous Avatar asked Dec 12 '25 12:12

Basbous


2 Answers

According to my case

I changed the structure to let the service to send a broadcast and receive it in the activity.

like image 189
Basbous Avatar answered Dec 14 '25 01:12

Basbous


See this link. Its a very good example of Service. It illustrates both way communication.

like image 33
jamael Avatar answered Dec 14 '25 01:12

jamael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!