How to check whether phone is connected to internet or not

Want to check internet connection on my android game

The easiest solution is probably to run a simple GET request against something like google.com using a simple C++ function like this one:

void AMyActor::RunInternetCheck() {

	TSharedRef<IHttpRequest, ESPMode::ThreadSafe> local_http = FHttpModule::Get().CreateRequest();
	this->SetHTTPTimeout();

	local_http->OnProcessRequestComplete().BindLambda([this](FHttpRequestPtr request, FHttpResponsePtr response, bool success) -> void {

		if(request->GetResponse()->GetResponseCode() == 200) {		

			/// ---> add your code here that gets executed when having internet connection

		}
	});

	local_http->SetURL("https://google.com");
	local_http->SetVerb("GET");
	local_http->ProcessRequest();
}

But Im using blueprint so how can I implement this in my blueprint project

BlueprintNode "Has Active Wifi Connection"can check whether your mobile is connected to wifi

link text

2 Likes

Continuing the discussion from How to check whether phone is connected to internet or not:
works for me:) also for windows and android as well

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

here you can check Internet Connect video URL link - https://youtu.be/68ulqbjn77o