Android 9.0 Testing
dev-hussein opened this issue · 4 comments
Problem
When test your repo it's not working on android 9.0 always return false.
Potential Solution
I think you have to check https://developer.android.com/about/versions/pie/android-9.0-changes-all#restricted_access_to_wi-fi_location_and_connection_information
Hi @TuiyTuyHussein at the moment the library does not support android 9.0, we hope to be able to perform some updates on the library soon!
I've been looking into this error. The problem comes from these changes
Framework Security Changes in API 28 Basically, for API 28+ no connection to clear text domains are permitted by default. Merlin
is using http://connectivitycheck.android.com/generate_204
to test connectivity, so when the demo project is compiled targeting API 28 the PingTask
is always returning false.
There are two possible solutions for the problem:
- Change the URL
Merlin
is using by default inEndpoint
tohttps://connectivitycheck.android.com/generate_204
- Use a network security config file to allow clear text connections to the domain
connectivitycheck.android.com
I've tested both solutions and they work well so it's just a matter of choosing what is best for the library.
This is the content of the network security config that I've tested
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">connectivitycheck.android.com</domain>
</domain-config>
</network-security-config>
As a workaround until this issue is addressed by the library you have two options @TuiyTuyHussein
- Add the following
code.withEndpoint(Endpoint.from("https://connectivitycheck.android.com/generate_204"))
toMerlin.Builder()
when you create yourMerlin
instance - Create a network security config file for the application that uses
Merlin
(or add the relevant content if you already have one in your project)
I'm down for updating the default endpoint to use the https
version, there's a slight performance hit but it should be negligible.
This might actually fix an issue with false positives from some wifi hotspots which force redirects on http
to their hotspot login page