Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Android 9 : Cleartext HTTP traffic to [MY_IP] not permitted

Discussion in 'Android' started by Simon75012, Dec 7, 2018.

  1. Simon75012

    Simon75012

    Joined:
    Sep 15, 2016
    Posts:
    53
    Hi,
    I start to receive a lots of message from Android P user.
    Error log on Android 9 only : "Cleartext HTTP traffic to 45.xx.xxx.xx not permitted"
    This error happens during WWW request.

    I tried to edit my androidmanifest :
    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest ...>
    3.     <uses-permission android:name="android.permission.INTERNET" />
    4.     <application
    5.         ...
    6.         android:usesCleartextTraffic="true"
    7.         ...>
    8.         ...
    9.     </application>
    10. </manifest>
    But it didn't fixed the problem.

    I saw this
    https://codelabs.developers.google.com/codelabs/android-network-security-config/index.html#3
    But i have no idea how to do the similar thing using Unity only (i don't use android studio).

    Thanks for help.
     
    Last edited: Dec 7, 2018
  2. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    935
    There's an easy solution: don't use insecure URLs.
     
  3. Simon75012

    Simon75012

    Joined:
    Sep 15, 2016
    Posts:
    53
    Thanks Yury,
    My database is on this server and my application is getting many informations from it.

    Is there a way to keep the same url and make it secured?
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,906
    No. You have to switch to HTTPS.
     
    Yury-Habets likes this.
  5. chemara

    chemara

    Joined:
    Nov 9, 2017
    Posts:
    1
    Any workaround for this without using https?
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,906
    Android native APIs do allow HTTP, at least using curl library it is possible. However, Java APIs (which is what UnityWebRequest is currently using under the hood) do not allow HTTP.