```I am currently developing an android service ap...
# android-architecture
u
Copy code
I am currently developing an android service app. A problem arose while developing a foreground service app. This is the situation when the activity gets data from the service. One way is to use a bind service and call a method from the service instance.
Another way is to get data using intents.

I've searched a lot, but almost all of them are using intents. If the lifecycle fits well, isn't it convenient and good to call a function as a bind service? I'd like to hear your opinion.
(In the service, it does not actually work, but creates and manages a working thread.)
f
You can use shared flow, state flow, channels...
👍 1
u
@FunkyMuse Yeah, i use shared flow now. Service has State flow. And thread emits new data to state flow, Activity only subscribe the state flow in service. So I think that there is no atomic issue to synchronize between main thread and worker thread.
f
Each of the flows you use are thread safe
👍 1