'Service info.mqtt.android.service.MqttService has > leaked IntentReceiver

I keep having this error log when ever i toggle off a switch in my app.

E/ActivityThread: Service info.mqtt.android.service.MqttService has leaked IntentReceiver info.mqtt.android.service.ping.AlarmPingSender$AlarmReceiver@9cd447c that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Service info.mqtt.android.service.MqttService has leaked IntentReceiver info.mqtt.android.service.ping.AlarmPingSender$AlarmReceiver@9cd447c that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:1724) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1462) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1684) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1650) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1638) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:686) at info.mqtt.android.service.ping.AlarmPingSender.start(AlarmPingSender.kt:58) at org.eclipse.paho.client.mqttv3.internal.ClientState.connected(ClientState.java:1214) at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:1050) at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:151) at java.lang.Thread.run(Thread.java:923)

The service is declared in the manifest file as follows:

<receiver
            android:name=".FirebaseNotification.MqttReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

<service
            android:name="info.mqtt.android.service.MqttAndroidClient"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE"
            tools:ignore="Instantiatable" />


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source