How to know if devices is connected to network?

Hello, i wanted to know if there’s a way to check if the current device is connected to a network via blueprints? or if there’s a way in C++ i don’t mind, it’s just that i don’t know that much of C++.

I’ve found a way but read that it was a solution for windows, so in case you need it, i’m most interest in learning this for mobile ( Android & IOS)

This is what i’ve found:

if(InternetCheckConnection(L"http://www.google.com",FLAG_ICC_FORCE_CONNECTION,0))
{
        cout << "connected to internet";
}

Ok so i figured it out, at least for mobile. There’s a blueprint node called “Connect to service” which returns an execution pin indicatend if it succeeded to connect or if it failed, one could use said node to know if the device is connected to a network.

Hi. Connect to service doesn`t work for PC. Is there something that can be detect internet connection on a PC?

Any help would be greatly appreciated.

I couldn`t find anything as InternetCheckConnection in Unreal. Which file has this function call?

Connect to Service is now deprecated, documentation suggests to use Show External Login UI instead.

Are you found solution of above question ?

Show External Login UI will bring up Google Play Service / IOS log in screen when you run it on a published game service. It’s probably not what you’re looking for.

Hey, any blueprints with your C++ code “Internet Check Connection” ? I really need some help.

To check whether or not you have a wifi connection you can use

FPlatformMisc::HasActiveWiFiConnection();

You can use it for mobile but it doesn’t really work for windows

static bool HasActiveWiFiConnection()
{
		// for now return true
		return true;
}

@Niyo_official
Hi, HasActiveWiFiConnection is the most relevant node (I’m using BP) I’ve found, but it always returns me false on the android device, weither I’m connected or not (via 4g+). Do you know if there is something else to do? I’m trying via “launch” maybe it works only for downloaded app?
thanks

Is there any way to know about mobile internet access?

It only tells you whether you are connected to wifi router not to 3G or 4G on your mobile.

For mobile access you better try to make a request for any website like google.com and then see if response is successful.

You can use this to detect WIFI / Mobile data in Mobile phone.

(1) How to Check if Android has Internet connection of not in Unreal Engine for Free - YouTube

I know this is an old thread, but I thought I’d chime in with a solution in case others come here as I hadn’t found a method as clean as what I have established in my project.

There is a free plugin call VaRest, i came across this plugin while trying to access and pull JSON API data from the net, for my purpose i wanted to get real world time to store on game exit, then compare to the time when app reopened.
In the attached image you can see how I implemented the network check.
I take the VaRest subsystem, construct a JSON object then use the “Call URL” function, from here i have the URL that gives the JSON data from the worldclockapi.
Then from the call back I have the event which contains the request variable that holds the data received from the URL, from there you can “Get Status”, then switch on the enum giving you outs for different results from the request. The key one here is obviously “Succeeded” being the device is online and made connection to the URL and “Failed” or “Failed Connection Error” meaning the URL connection failed.
I believe “Failed” can occur if simply the URL is wrong or currently unavailable so connection error type would be a safer bet if simply attempting to get internet connection status.

I have yet to actively try this on a mobile device, but it works on PC and because of the functionality I can’t see why it would not work on mobile devices.

Hope this helps someone else looking for a solution!

I was just testing this exact thing out and wanted to share this and now I see that you got an answer already :slight_smile:

It can be slightly simplified like this:

If there is no Network connection the Custom Event (NetworkTest Response) will not trigger at all, you’ll only get some info in the Output Log
If the Network works - it will trigger the Custom Event as intended :slight_smile:

Hi I am currently struggling to get this to work properly I need to keep a check on the status of the internet connection throughout game play not just on event begin play does any one have a clean example of how this can be done with this plugin through blueprint preferable a screen shot of the codes :slight_smile:

Thanks Joanne