The other day I studied the otto library, it is very similar to broadcastreceiver, in my project I get this service from the service and send it to the fragment. What would you recommend using otto or broadcastreceiver? via otto cleaner code.
3 answers
Otto is better broadcastreceiver. At the time, he switched to Otto from the receiver and is only happy about it.
On the other hand, the Otto creators themselves talk about the obsolescence of their library and call for switching to RxAndroid.
- For the first time I hear about the removal or prohibition of
BroadcastReceiver. Can I source? - Eugene Krivenja pm - @EugeneKrivenja, I clearly remember that I read something like this when they announced a new version, but now I couldn’t google anything ... 0_o - YuriySPb ♦
- There was something that the delivery of system events was changing, but not the
BroadcastReceiveritself. Your own events will run as before. - Eugene Krivenja - @EugeneKrivenja, well, apparently I misunderstood something then) I removed it from the answer) - Yuriy SPb ♦
- oneIt is well-written here, maybe someone will need it :) r-bricks.com/2016/04/… - Eugene Krivenja
|
I think that to get a clean code, you do not need to use any of the above, such bass is like a goto , you can do whatever you want, completely confusing the code.
|
In your particular case, I would advise the binding service . The fragment is perfectly connected-disconnected to the service according to the life cycle, and the service to all connected distributes the data. And no third-party libraries.
|