1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Android http_get not working on Android [SOLVED]

Discussion in 'Programming' started by emicarra, Nov 25, 2019.

  1. emicarra

    emicarra Member

    Joined:
    Jul 2, 2017
    Posts:
    60
    Hello, i did this simple code to get my external ip by using http_get("ipv4bot.whatismyipaddress.com");, it works fine on Windows, but on Android it shows this error in the console:

    java.io.IOException: Cleartext HTTP traffic to ipv4bot.whatismyipaddress.com not permitted

    Does anyone know how to fix this? Thanks
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,851
    Recent versions of Android stopped allowing plaintext HTTP traffic by default. Use HTTPS instead.
    Code:
    http_get("https://ipv4bot.whatismyipaddress.com");
     
    emicarra likes this.
  3. emicarra

    emicarra Member

    Joined:
    Jul 2, 2017
    Posts:
    60
    Thank you! I'm so glad the solution was this simple!
     

Share This Page