I have an Android Service that is giving me the following error message when it is being destroyed:
Service io.aeroscope.aeroscope.AeroscopeBluetoothService has leaked IntentReceiver com.polidea.rxandroidble.RxBleAdapterStateObservable$1$1@3d91b742 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:944)
The only subscription in the service is unsubscribed in the onDestroy()
method (shown in its entirety):
if( !scanSubscription.isUnsubscribed() ) scanSubscription.unsubscribe();
super.onDestroy();
Where is this message coming from and how do I fix it? (Also, is the test for .isUnsubscribed()
needed? Should super.onDestroy()
come first?)