-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activity has leaked IntentReceiver #28
Comments
Can you provide code, which caused this error? It will be much more easier to reproduce this bug and fix it. Without that, it's quite hard. In your error, we can see message Where do you call |
Sure, here's the code, I'm using, hope this helps. This is the method that does the subscription private void checkWifiConnection() {
mWifiSubscription = new ReactiveNetwork().observeConnectivity(mActivity)
.observeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.subscribe(connectivityStatus -> {
if(connectivityStatus == ConnectivityStatus.WIFI_CONNECTED) {
Log.w(TAG, "wifi connected!");
hasWifi = true;
if(!isConnected) {
establishConnection();
}
} else {
Log.w(TAG, "wifi not connected! " + connectivityStatus);
hasWifi = false;
}
});
} And here I call public void closeConnection() {
mWifiSubscription.unsubscribe();
mActivity.finish();
} |
Thanks! |
|
Okay, I rewrote a few parts of the code and re-located the method calls and now it seems to work without the error. |
Great! I'm glad you found source of the problem and fixed it. :-) |
I'm using ReactiveNetwork in a normal Java class and pass an Activity as the Context.
Before the Activity gets destroyed I call
mSubscription.unsubscribe
, but the error still occurs.Maybe you can have a look at it?
The text was updated successfully, but these errors were encountered: