Skip to content Skip to sidebar Skip to footer

Android Api (okhttps) Not Getting Called In Android 9(pie) And Above

I am calling the android API in the same way as for other versions of phone and its working fine till Oreo version i.e. 8. But the API is not getting called in android 9 i.e. pie v

Solution 1:

Android 6.0 introduced the useCleartextTraffic attribute under the application element in the android manifest. The default value in Android P is “false”. Setting this to true indicates that the app intends to use clear network traffic.

<application
    android:usesCleartextTraffic="true"

</application>

However, this may appear to fix the problem but it opens a threat to data integrity. A better solution is offered in Android 7.0 through network security configuration file

Solution 2:

Add below lines in your project's AndroidManifest.xml file

<applicationandroid:usesCleartextTraffic="true">
            ...
</application>

Post a Comment for "Android Api (okhttps) Not Getting Called In Android 9(pie) And Above"