1

In my Android app I want to broadcast some notifications. In the MainActivity I register BroadcastReceiver which handles messages but as I understand it is not recommended to use global BroadcastReceiver if I do not want to send messages out of the app. Instead of this a LocalBroadcastManager or Handler should be used. In my case LocalBroadcastManager is more suitable but according to documentation it is part of a support library.

My app supports only Android 4 and 5 so I am not using support library. Is there a way how to use LocalBroadcastManager without support library? Thanks

DanielH
  • 953
  • 10
  • 30

2 Answers2

3

My app supports only Android 4 and 5 so I am not using support library. Is there a way how to use LocalBroadcastManager without support library?

No there is not. As the ViewPager and another small amounts of Widget/Classes, LocalBroadcastManager is part only of the support library

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
0

Try using localbroadcastmanager Maven artifact. It doesn't need "support-v4".

implementation 'com.android.support:localbroadcastmanager:28.0.0'