Check Network Connectivity State With Delphi XE5 Firemonkey On Android And IOS

Check Network State Delphi FiremonkeyIf you are looking for a cross platform way to check for connectivity in your Delphi Firemonkey apps on Android and IOS then this might be the solution for you. It is a simple set of free classes that lets you do just that. For IOS it requires a small static library be included as well. It has properties to report back on if there is any connectivity at all and whether that connectivity is via Wifi or Mobile data. Personally I found it pretty useful because it is cross platform and will tell you the connectivity regardless if it is Android or IOS. It doesn’t report connectivity on Windows so you’ll have to add that part yourself with IFDEFs.


You can also use some code like this from Daniel Magin as a backup if you need to (put your own domain place of google.com):

Update: Apparently on IOS you should never do synchronous network calls (including this check connectivity functionality) in the main thread. We’ve run into problems with this on iPad Air devices. One recommendation is to place this connectivity check in an anonymous background thread.

Head over and download the class and demo for NetworkState.

 

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

Check Network Connectivity State With Delphi XE5 Firemonkey On Android And IOS by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.

17 Responses to Check Network Connectivity State With Delphi XE5 Firemonkey On Android And IOS

  1. Pingback: Polish Your Delphi XE5 Firemonkey Apps For IOS With These Twelve Tips | Delphi XE5 Firemonkey, Delphi Android, Delphi IOS

  2. Pingback: Ten Tips For Creating Professional Android Apps With Delphi XE5 Firemonkey | Delphi XE5 Firemonkey, Delphi Android, Delphi IOS

  3. Pingback: Polish Your Firemonkey Apps For IOS With These Twelve Tips | Firemonkey X

  4. Pingback: Ten Tips For Creating Professional Android Apps With Firemonkey | Firemonkey X

  5. Veeresh says:

    Not working in Delphi XE7. Please do needful.

  6. Veeresh says:

    By default for “Internet” the permission is true ?

  7. Veeresh says:

    Moto G (Android)

    In XE6 i have called it deirectly on main thread only. There it is working fine. Where as in XE7 it is not.
    I have tried it in Anonymous thread also as suggected by you. Once it is trying to call NetworkState.IsConnected it is giving access violation error. I believe some thing is going wrong in “NetworkState.Android”, but unable to trace it.

  8. Veeresh says:

    Please attach some sample demo code for Delphi XE7 version. I will check where it is going wrong.

  9. Pingback: Ten Tips For Building Stunning Professional Android Apps With Delphi XE7 Firemonkey | Delphi XE5 XE6 XE7 Firemonkey, Delphi Android, Delphi IOS

  10. Warquia Pereira says:

    Good evening, How Can I Download the sources , because the site in question has not the Link to download.
    Thank you!!

  11. Pingback: Must Have Check Network Connectivity State Library For #Delphi XE8 Firemonkey On #Android And #IOS | Delphi XE5 XE6 XE7 XE8 Firemonkey, Delphi Android, Delphi IOS

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Parse RSS Feed In Delphi Firemonkey Android IOS
Parse An RSS Feed Using Delphi XE5 Firemonkey On Android And IOS

If you want to manually parse an RSS feed and not use Livebindings here is a code snippet to do...

Close