Issue
i have 2 phones, api(28, 17) so when request HTTP, it work with api 17
but not in api 28, friend said that, i must use
android:usesCleartextTraffic="true"
in Manifest, but when build it work in the phone (api 28), api 17 not get request.
so is there any if condition, i can check sdk version, i tried, this.in java Main activity
if (android.os.Build.VERSION.SDK_INT > 23) {
android:usesCleartextTraffic="true"
}
any help to make this app get request from http without any error for both devices.
but i don't know much, im still beginner.
Solution
AndroidManifest:
<application
android:networkSecurityConfig="@xml/network_security_config"
and in res>xml add network_security_config.xml file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true"/>
</network-security-config>
Answered By - Ganesh Pokale
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.