Skip to content Skip to sidebar Skip to footer

Data Not Showing On Android Pie 9.0

After I updated my phone from Android Oreo 8.0 to Android Pie 9.0, I no longer can get data from MySQL database using HttpUrlConnection. I try with emulator Android Oreo 8.0 and th

Solution 1:

I Recently had the same issue for Android 9, but I had to use some URLs for different screens. So I added android:usesCleartextTraffic="true" to Manifest and it worked, but we didn't want to compromise the security of the whole app for this. So the fix was in changing links from HTTP to https.But if you had to use only http to communicate with your app then here is your solution.

android:networkSecurityConfig="@xml/security_config"

Add this in the Xml

<network-security-config><base-configcleartextTrafficPermitted="true"/><debug-overrides><trust-anchors><certificatessrc="system" /><certificatessrc="user" /></trust-anchors></debug-overrides></network-security-config>

Solution 2:

If your app targets Android 9 or higher, the isCleartextTrafficPermitted() method returns false by default.

If your app needs to enable cleartext for specific domains, you must explicitly set cleartextTrafficPermitted to true for those domains in your app's Network Security Configuration.

Framework Security changes in Android 9 that improve your app's security

Post a Comment for "Data Not Showing On Android Pie 9.0"