I’m trying to send data from an android service to...
# android
v
I’m trying to send data from an android service to an activity. I would usually do this with a broadcast receiver, but I was wondering if this was something I could use a Coroutine channel for and how would that work?
p
You could create an event bus using private channel; exposing a flow and having suspend functions which send to the channel
c
Or follow the examples they have of such things in the architecture patterns, using a
ViewModel
. As usual, 10 different ways to do it.
v
@codeslubber What examples? Could you provide the link?
m
Try -Event Bus -Handler (send message)
v
Was looking for a solution based on Coroutine channels, but I figured it out based on Paul’s suggestion