HTTP issue on Android

Hi, I am trying to make HTTP calls to reach the end point of a server local to my LAN with URL :

http://IP:PORT

On Windows the method std::unique_ptr URL::createInputStream (const InputStreamOptions& options) const;
does its job well, while on Android it seems that all HTTP requests are not accepted , in fact the method URL::createInputStream (const InputStreamOptions& options) const returns nullptr!

I guess since inside the method : bool connect (WebInputStream::Listener*); there is this check :

if (stream != nullptr && ! stream.callBooleanMethod (HTTPStream.connect))
stream.clear();

where stream.callBooleanMethod (HTTPStream.connect) always returns false when it comes to HTTP call.

Could someone help me out ? I would be very grateful.

By default you can’t make unencrypted HTTP connections on Android, only HTTPS.

You can enable HTTP through the manifest, e.g. by adding the following Custom Manifest XML Content to your Android exporter settings in the Projucer.

<manifest>
<application android:usesCleartextTraffic="true">
</application>
</manifest>
1 Like

Thanks for your response but it still not works with HTTP.
Should i enable other contents to the manifest.xml?

I’m using Android 13.0