LocalBroadcastManager已被废弃

今天运行程序测试的时候突然报错,检测了一下居然找不到androidx.localbroadcastmanager.content.LocalBroadcastManager

本地广播这个类,最终在官网找到了答案

This class is deprecated.
LocalBroadcastManager is an application-wide event bus and embraces layer violations in your app: any component may listen events from any other. You can replace usage of LocalBroadcastManager with other implementation of observable pattern, depending on your usecase suitable options may be 
LiveData or reactive streams.

 

官网地址:https://developer.android.google.cn/reference/androidx/localbroadcastmanager/content/LocalBroadcastManager.html?hl=en

你可能感兴趣的:(废弃)