Why my HTTP request to the iot device doesn't work

49 views Asked by At

i ve been trying to send HTTP request to a iot device from my react native app, the iot device works as a access point and got the ip of http://192.23.77.7:80, my react native app works just fine in bluestacks, and if i directly copy the url and send get request in browser url its also just works fine, but when i try to send get request to the url i got this error <=======>,

So im assuming if i can find out why the requests works just fine in bluestacks but doesn't work in my android device, can fix the problem

MY ANDROID PERMISSIONS

"

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />enter code here"

THE CODE THAT IM RUNNING FOR REQUEST

async function getReq(e) {
await axios
  .get('http://192.23.77.7/param/?param1=101')
  .then(res => {
    console.log(res);
    settext(res);
  })
  .catch(err => {
    console.log(err);
    settext(err);
  });

}

I TRIED THOSE

-FETCH/AXIOS -APK NETWORK PERMISSION -IPCONFIG TO FIND THE IP (BUT ITS ALREADY THE SAME IP) -TRIED ANOTHER ANDROID DEVICE

--Solved

i basically added this codeblock to my AndroidManifest.xml and it solved my problem

<application android:usesCleartextTraffic="true">
0

There are 0 answers