1

From Android 9, Android blocks cleartext traffic (HTTP), unless the app explicitly allows it in the configuration.

I added android:usesCleartextTraffic="true" to the application field in AndroidManifest.xml and it works successfully.

The question is, what is the correct way to allow clear text HTTP traffic in ionic?

I believe edit the AndroidManifest manually is not the correct way.

RafaelJan
  • 3,118
  • 1
  • 28
  • 46
  • check this : https://stackoverflow.com/q/45940861/7666442 and this one https://stackoverflow.com/q/55074899/7666442 – AskNilesh Jun 04 '19 at 07:29
  • Thanks but these answers are for regular development with Android. I don't know if this is the right way for ionic development – RafaelJan Jun 04 '19 at 08:32

1 Answers1

0

Android Documentation states:

Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value is "true".

So basically this is the official way to implement and explicitly allows HTTP traffic

To check at runtime if the ClearText is permitted use NetworkSecurityPolicy.isCleartextTrafficPermitted() method.

EDIT

If you want to modify AndroidManifest.xml in ionic the must visit this link.

Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60