I'm using the ConnectivityManger's requestNetwork
API to programmatically connect to a specific network specified by a NetworkRequest
object provided as first parameter. I also provide a NetworkCallback
to receive notifications related to the status of the request.
Starting from API 29, the OS is showing a Dialog (NetworkRequestDialogFragment
) where the user can select a network from the list or cancel the action.
According to the documentation, the NetworkCallback's onUnavailable
method is invoked when the user clicks on the dialog's cancel button but also in case of connection failure.
Is there any advanced mechanisms to distinguish between these two scenarios?
onUnavailable()
is only called in two scenarios:onUnavailable()
as well.As for your questions, I don't think there's either a way of intercepting neither this Dialog or the second Dialog you get once
onUnavailable()
is triggered stating that there was an error -- I've been looking all over the place for something like this too. :/