react-native-tethering icon indicating copy to clipboard operation
react-native-tethering copied to clipboard

iot device's http server is not accessible on release build

Open dongalor opened this issue 2 years ago • 7 comments

Hello there! I have this strange issue with accessing web server on iOt device on release build (running on expo works fine). After connecting to iOt's wifi with no internet access I can't make http requests to it. Tuning permissions in manifest like this https://gist.github.com/dongalor/55393a2af28f8a2d0d3f5f6aa32daec2

Thank you for any advice in advance :)

dongalor avatar Nov 09 '23 19:11 dongalor

which android version do you use?

aboozaid avatar Nov 10 '23 20:11 aboozaid

which android version do you use?

Oh! I'm using Android 12 if you asking about my phone's android.. :)

dongalor avatar Nov 10 '23 20:11 dongalor

I think this is out of the package scope but you have to ensure both devices are on the same network and get their IPs in order to communicate.

aboozaid avatar Nov 12 '23 09:11 aboozaid

I think this is out of the package scope but you have to ensure both devices are on the same network and get their IPs in order to communicate.

When I run my app via expo and connect with react-native-tethering to my iOt's wifi, I can do requests, but when I build release apk it doesn't work.

dongalor avatar Nov 12 '23 11:11 dongalor

I think this is out of the package scope but you have to ensure both devices are on the same network and get their IPs in order to communicate.

When I run my app via expo and connect with react-native-tethering to my iOt's wifi, I can do requests, but when I build release apk it doesn't work.

I need some logs in order to debugging

aboozaid avatar Nov 12 '23 17:11 aboozaid

I think this is out of the package scope but you have to ensure both devices are on the same network and get their IPs in order to communicate.

When I run my app via expo and connect with react-native-tethering to my iOt's wifi, I can do requests, but when I build release apk it doesn't work. @dongalor Use : (android:usesCleartextTraffic) The default value for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false". When the attribute is set to "false", platform components, for example, HTTP and FTP stacks, refuse the app's requests to use cleartext traffic.

Add android:usesCleartextTraffic="true" in your manifest inside tag. This will resolve your issue.

sardanadeepak avatar Nov 16 '23 19:11 sardanadeepak

Thank you so much for help.

Add android:usesCleartextTraffic="true" in your manifest inside tag. This will resolve your issue.

So, I've added this to my android/app/src/main/AndroidManifest.xml

<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:requestLegacyExternalStorage="true" android:usesCleartextTraffic="true">

Still not works, trying to do clean rebuild of my app.

Also, I've found some information about intent-filter config here: https://stackoverflow.com/questions/40543618/does-data-androidhost-www-calender-com-androidscheme-http-data-make-ap, is it possible that accessing http within these permissions might need something like this?

I've also added some security configs same way as described in similar problem of similar library: https://github.com/JuanSeBestia/react-native-wifi-reborn/issues/323

Still not working :(

dongalor avatar Nov 22 '23 19:11 dongalor