Search code examples
androidlocalbroadcastmanager

Can we use localbroadcast receiver to communicate between activity and service?


Hello I am working on android application where I want to use LocalBroadCastManager. I want to perform network operation in service and send result to activity from there using LocalBroadCastManager.

Is it possible to do that using LocalBroadCastManager or Do I have to do same in different method ?

Thanks in advance.


Solution

  • Yes, you can ! But be sure to not use this service in another process ! Check your manifest and see if where you declared your service you haven't used the tag android:process, if you haven't you are good to go !