Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodC++BuilderCode SnippetComponentDelphiFiremonkeyIOSOSXWindows

Must Have Check Network Connectivity State Library For #Delphi XE8 Firemonkey On #Android And #IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE8 Firemonkey Check Status Internet Connection Android IOS | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSDeveloper Dave Nottage has upgraded his network state library for Delphi XE8 Firemonkey. The latest version of the component includes an IOS64 version of the static libReachability.a library. If you are doing any kind of internet connections in Delphi XE8 this is a must have library. You should check if there is an internet connection on Android, IOS, OSX, and Windows prior to attempting to making a connection. The component is free. Even if you are only using the app tethering functionality of Delphi XE8 Firemonkey you should also use this component. There are multiple ways to check for an internet connection and this is one of them. In certain instances it is not enough however to just use the library (like for example when an IOS device has it’s internet connection disabled). A second important piece that I use is this function created by Daniel Magin (you can change out the google.com host for your own domain name):
function TdmMain.CheckInternet: boolean;
begin
result:=false;
try
IdTCPClient1.ReadTimeout:=2000;
IdTCPClient1.ConnectTimeout:=2000;
IdTCPClient1.Port:=80;
IdTCPClient1.Host:='google.com';
IdTCPClient1.Connect;
IdTCPClient1.Disconnect;
result:=true;
except
result:=false;
end;
end;

Be aware however that on IOS you must make internet connections asynchronously otherwise you risk the chance that IOS will close your application. If your connection takes more than ~10 seconds IOS may think your app is frozen and close it. What I do is set up a private boolean variable which contains the internet status. I then update this variable using the various methods and when I need to know the internet state I just check the boolean variable. This library and code should also work in Appmethod. You can check out our previous post about the network state component here.

Head over and download the network state component library for checking the internet connection in Delphi XE8 Firemonkey.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

4 Comments

Leave a Reply