mirror of https://github.com/grpc/grpc-java.git
android: fix for app coming to foreground
When an app goes to the background, onBlockedStatusChanged is called with true and then called with false when it comes back to the foreground. The function onAvailable isn't called in this case and the connection wasn't being reset. Closes #8850 I noticed the comment that this is used for API versions 24+ but onBlockedStatusChanged was added in 29. I'm not sure if some kind of guard needs to be added or not. https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback#onBlockedStatusChanged(android.net.Network,%20boolean)
This commit is contained in:
parent
7308d92034
commit
ca4a1d8ca3
|
|
@ -297,6 +297,11 @@ public final class AndroidChannelBuilder extends ForwardingChannelBuilder<Androi
|
|||
public void onAvailable(Network network) {
|
||||
delegate.enterIdle();
|
||||
}
|
||||
@Override
|
||||
public void onBlockedStatusChanged (Network network, boolean blocked) {
|
||||
if (!blocked)
|
||||
delegate.enterIdle();
|
||||
}
|
||||
}
|
||||
|
||||
/** Respond to network changes. Only used on API levels < 24. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue