Open NathanSass opened 2 years ago
Thanks for reporting.
I think the fix we provided is probably much easier than what it needs here. There, we catch the SecurityException
that is thrown by the system when we call getNetworkCapabilities()
and then we assume that the internet connectivity is successfully validated. So on devices with this bug that causes throwing the SecurityException
, this makes it work approximately the same as for API levels prior to 24 when no such a test was possible.
With the case of registerDefaultNetworkCallback/unregisterNetworkCallback
it is more difficult I think, because the exception is raised when we try to register a network callback that is used to be aware of the network status to start/stop downloads. As far as I understand, we can not just switch to the alternative (< API 24) broadcast receiver on higher APIs because this has been deprecated in favor of the network callbacks of which registration throws the exception you are reporting. For recent APIs levels we can not expect that the alternative broadcast event is emitted.
We need to investigate what's best to do here and whether there are ways to avoid the crash and still have awareness of changes in the network availability to start/stop downloads accordingly.
Hey @marcbaechinger ,
I'm also experiencing this bug on Android 11, and I'm a bit worried considering the DownloadManager
is required for downloading content but I'm unable to initialise it. I would have thought the inability to download on Android 11 would be fixed sooner, but perhaps I'm missing something!
Will the DownloadManager
initialiser be fixed for Android 11?
Is there anything I can do in the meantime to work around this?
Looking forward to your response, thank you!
This issue is a continuation of 9002. We are still getting the original crash posted in the issue, because the solution shipped is modification to
Requirements.isInternetConnectivityValidated
which is not in the original stack trace.The fix in 9002 is for
ConnectivityManager.getNetworkCapabilities
butConnectivityManager.registerDefaultNetworkCallback
also throws that exception and it is not handled.