unregisterReceiver error

Hello everyone,

I’m using realm database for android and kept getting unregisterReceiver error when press back button. I’m closing my realm during onDestroy and initializing Realm.init(this) during onCreate.

Is there something I’m missing to close here.

This is the Exception I’m getting

2020-08-19 21:09:14.617 18966-18966/com.example.realm E/ActivityThread: Activity com.example.realm.MainActivity has leaked IntentReceiver io.realm.internal.network.NetworkStateReceiver@805ae25 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.example.realm.MainActivity has leaked IntentReceiver io.realm.internal.network.NetworkStateReceiver@805ae25 that was originally registered here. Are you missing a call to unregisterReceiver()?
override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Realm.init(this) #Exception refers to this line of code
}
2 Likes

someone knows the answer?