I have an android Studio app trying to implement MQTT. The example I am modifying uses androidx.localbroadcastmanager.content.LocalBroadcastManager but it is deprecated. I am trying to replace this with something else but I can't find any good examples. Here is the code that I use.
build.gradle //(module)
dependencies {
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
}
in JavaClass
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
private void registerReceiver(BroadcastReceiver receiver) {
IntentFilter filter = new IntentFilter();
filter.addAction(MqttServiceConstants.CALLBACK_TO_ACTIVITY);
LocalBroadcastManager.getInstance(myContext).registerReceiver(receiver, filter);
receiverRegistered = true;
}
This seems to be the only place it is used.
I'm sorry if what I have here isn't enough but I am new to this and could use a lot of help. Just let me know what more you need.