Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Eazy NetChecker - Reliable Internet Detection

Discussion in 'Assets and Asset Store' started by JackMini36, Jul 17, 2018.

  1. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21

    Easy and reliable internet detection

    Do you want to truly know your game can reach the internet? Eazy NetChecker is the right tool! Eazy NetChecker is a light but reliable and powerful tool for really determining the status of the internet connection on all devices and platforms.

    Methods like Unity's Application.internetReachability cannot truly tell if a device is actually connected to the internet, and neither was designed to do so. Moreover, simple methods like pinging google are unreliable since devices could appear to be connected to the internet, but in reality be behind a restricted network. Eazy NetChecker is the solution to all that! By utilizing a technique called Captive Portal Detection, it can quickly and reliably determine the current internet connection. Caprive Portal Detection is a technique that is used in all major operating systems for detecting internet connectivity.

    Reliable internet detection
    Check whether your game can truly reach the internet or your server. By utilizing a technique called Captive Portal Detection, it can quickly and reliably determine the current internet connection, unlike unreliable methods often used by developers. Captive Portal Detection is a technique that is used in all major operating systems for detecting internet connectivity.

    Prespecified industry standard check methods
    Eazy NetChecker comes with a few ready to use check methods, which are used by Google, Microsoft and Apple for their own internet detection algorithms. Moreover, you can set Eazy NetChecker to always automatically select the most appropriate check method depending on the platform your game is running on.

    Custom check methods
    Eazy NetChecker is fully flexible and extentable since it allows you to create your own custom check methods to specifically fit your needs.

    Events
    Various events are raised during the lifetime of an internet check, which allow you to easily implement various different logics based on your requirements.

    Easy to use editor
    A fully custom editor is included which gives you the option to set everything up in Unity editor, limiting the coding required during runtime.

    Super easy integration
    Integrating Eazy NetChecker into an existing project is extremely easy. Just add a few lines of code for internet detection and that's it!

    Runtime API
    Handle all tasks from code using a simple but in-depth API, which can give you full control over internet detection.

    Fully documented
    Full online and offline documentation, including an API reference and an in-depth manual.


    EXAMPLES
    Just a few simple examples of different ways you can use Eazy NetChecker

    Example 1:
    Code (CSharp):
    1. private void Awake()
    2. {
    3.     EazyNetChecker.UseGoogle204Method();
    4.     EazyNetChecker.OnConnectionStatusChanged += OnNetStatusChanged;
    5.     EazyNetChecker.StartConnectionCheck();
    6. }
    7. private void OnNetStatusChanged()
    8. {
    9.     Debug.Log("Internet Connection Status changed to: " + EazyNetChecker.Status);
    10. }
    Example 2:
    Code (CSharp):
    1. private void Awake()
    2. {
    3.     EazyNetChecker.UseGoogle204Method();
    4.     EazyNetChecker.StartConnectionCheck();
    5. }
    6. private void Update()
    7. {
    8.     if(EazyNetChecker.Status == NetStatus.Connected)
    9.     {
    10.         Debug.Log("Yeyyyy, I have internet!");
    11.     }
    12.     else
    13.     {
    14.         Debug.Log("No internet :(");
    15.     }
    16. }
    Read the Documentation for more examples and more in-depth explanation

    FEATURES LIST
    • Reliable detection of internet connection status (Pending, NoConnection, WalledGarden, Connected)
    • Pre-specified captive portal detection check methods (Google204, MicrosoftNCSI, AppleHotspot)
    • Custom check methods
    • Automatically select the best check method for each build platform
    • Control over when checks are performed
    • On Start: Run a check when your game is loaded
    • Continuously: Automatically run checks on configurable intervals
    • Manual: Run a single check whenever you need it.
    • Stats and info about internet status and connectivity
    • Helpful events to listen to (OnStart, OnFinish, OnStatusChanged, OnTimeout)
    • Runtime API (Fully documented)
    • Easy to use Editor
    • Super easy integration
    • Full C# source code

    COMPATIBILITY
    • Multi-platform support (Windows, Mac, Linux, Android, iOS)
    • Unity 5.6 or higher

    DEMOS
    Windows Demo
    Android Demo

    DOCUMENTATION
    Manual
    API Reference

    SUPPORT
    If you need help, have a question or want to request future features, please feel free to contact us and we will get back to you as soon as possible. You can send us an email at support@hellmadegames.com, contact us on Facebook, or post on this thread.

     
    Last edited: Mar 14, 2019
    Liminal-Ridges likes this.
  2. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi,

    Could you please tell me does this asset work with Android 9.0 Pie? It expects apps to use HTTPS by default and HTTP is permitted only as a configured exception.
     
  3. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21
    Hello Nadan,

    It does work on Android 9, but as you have already mentioned it will not allow HTTP without you configuring the Android manifest. See here how to do that: https://developer.android.com/training/articles/security-config

    Of course, custom check methods using HTTPS do still work fine without any configurations.
    We will modify the standard check methods with HTTPS links (if their providers have one) so they will work with Android 9 without changes to the manifest as well.

    Best,
    Jack
     
    Last edited: Jan 2, 2019
  4. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21
    Version 1.1.0 is now live!

    Added
    - Warning messages on editor (Invalid link & unsafe cleartext HTTP link)
    - Connection statistics (Editor & API)

    Changed
    - Standard check methods (Secure version of google204, Miscrosoft NCSI to Microsoft Connect Test, Secure version of apple hotspot)
    - NetCheckMethod implementation from WWW to UnityWebRequest

    Fixed
    - Non-stop debug message after time out
     
  5. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
    Hi @JackMini36
    Does your asset determines, when user switches from WiFi to Carrier Network internet on mobile phone?
    I would guess, that there is a time, when the device has no access to the internet, so it could be detected by that, but the timeframe without internet is not set. I do not want do do the test every Update to check it out. Is there a reliable way, hot to figure it out?

    Do i have to use https://docs.unity3d.com/ScriptReference/Application-internetReachability.html to check it? Is it compatible with your solution?

    We need to have a complex connection information because we are using 3rd party server side component, which is... very poorly designed to handle changes between network carrier and wifi internet connection.
     
  6. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21
    Hello Jochanan,

    You can check whether it is Wifi or carrier network by using the EazyNetChecker.ReachabilityType Property:
    http://www.hellmadegames.com/projec...lmade_Net_EazyNetChecker_ReachabilityType.htm

    However, currently there is no event that will be triggered when the value of this property changes. You need to check yourself whenever you need to. Although such event could be added easily.

    If you want to check if there is an internet connection in general (or if it down at the moment), you can do it by starting a continuous internet check, instead of a single one:
    http://www.hellmadegames.com/projec...Net_EazyNetChecker_StartConnectionCheck_1.htm

    By using the above you can set your own interval for the checks. Whenever the internet connection status changes, an event will be raised. You just have to listen to this event:
    http://www.hellmadegames.com/projec..._EazyNetChecker_OnConnectionStatusChanged.htm

    Check out the "Continuous check" section in the manual for further explanation and an example:
    http://www.hellmadegames.com/projects/eazy-netchecker/docs/manual/Manual.pdf

    Please let me know if that covers your question or if you need more info.
     
    Jochanan likes this.
  7. Karsnen_2

    Karsnen_2

    Joined:
    Nov 28, 2011
    Posts:
    89
  8. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21
    Hello Karsnen_2

    I am glad you like Eazy NetChecker :)

    Timeout is basically how long an internet check will keep trying to determine the internet connection status. If that time is passed and the check was not able to do that yet, it will just timeout. That means it will stop and decide that there is no internet connection.

    Timeout can usually happen when your actual connection is bad or unstable.

    Hope that helps. Please let me know if you need more info.
     
  9. Karsnen_2

    Karsnen_2

    Joined:
    Nov 28, 2011
    Posts:
    89
    Target Platform: iOS 12.0 +
    Unity Version : 2018.4.10F1

    Scenario

    I initiate your plugin at the very start of the application. Then for the entirety of the application whenever I need to know if there is internet available, I use your plugin. Your plugins runs with "Eazy NetChecker" gameobject being persistent. I know the status of the net by listening to this event

    Code (CSharp):
    1. EazyNetChecker.OnConnectionStatusChanged += OnNetStatusChanged;
    When the net status is
    NetStatus.Connected:

    then I consider that there is internet connection. Else no internet availability.
    Implementation

    The way I implement the above is as below

    Code (CSharp):
    1. private void Start()
    2. {
    3.     EazyNetChecker.UseGoogle204Method();
    4.     EazyNetChecker.StartConnectionCheck();
    5. }
    6.  
    7. private void OnEnable()
    8. {
    9.     EazyNetChecker.OnConnectionStatusChanged += OnNetStatusChanged;
    10. }
    11.  
    12. private void OnDisable()
    13. {
    14.     EazyNetChecker.OnConnectionStatusChanged -= OnNetStatusChanged;
    15. }

    Question

    Let's say there is a timeout, what will be the value of [http://www.hellmadegames.com/projec...html/P_Hellmade_Net_EazyNetChecker_Status.htm]
    There are two scenario's to the above question
    1. It gets a timeout due to no internet connection, in which case it would be [NetStatus.NoDNSConnection]
    2. When timeout happens, my understanding is that Hellmade.Net.EazyNetChecker.CheckConnectionCoroutine() co-routine is stopped. Subsequently, when internet connectivity resumes for the device -> how does the system respond to that
    Please advice.
    Thank you for your time.
     
  10. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21

    Hello Karsnen_2

    The Status will always be NetStatus.NoDNSConnection after a timeout. And you are right, Hellmade.Net.EazyNetChecker.CheckConnectionCoroutine() will be stopped after a timeout. That means the check will be interrupted. You can restart it to retry to get the connection status. You can easily do that by listening to OnCheckTimeout, and start a connection check there again.

    Please let me know if you need more info, or some code examples.
     
    Karsnen_2 likes this.
  11. pgvix

    pgvix

    Joined:
    Jun 9, 2021
    Posts:
    3
    Is it possible to do the periodical check only when offline? I don´t need to continuously check when connected, I need to check only after some failed query - ie., after a qyery fails, I need to know when the connection is back again. Is it possible to do this?
     
  12. JackMini36

    JackMini36

    Joined:
    Feb 13, 2014
    Posts:
    21
    Hello pgualandi

    Yes you can do that. Just listen to the OnConnectionStatusChanged event, and check the status there. If offline, start a new continuous check. If not, stop it. Make sure to first start a continuous check.

    Something like:

    Code (CSharp):
    1. ...
    2.  
    3. // Start listening
    4. EazyNetChecker.OnConnectionStatusChanged += OnNetConnectionStatusChanged;
    5.  
    6. ...
    7.  
    8. // Stop listening when you don't need it
    9. EazyNetChecker.OnConnectionStatusChanged -= OnNetConnectionStatusChanged;
    10. ...
    11.  
    12. private void OnNetConnectionStatusChanged()
    13. {
    14.     if(EazyNetChecker.Status == NetStatus.Connected)
    15.     {
    16.         // stop the continuous check
    17.     }
    18.     else
    19.     {
    20.         // start the continuous check
    21.     }
    22. }
    Check the docs for more info on how to use the events.
     
  13. yilianxin

    yilianxin

    Joined:
    Jan 22, 2015
    Posts:
    8
    "Thank you for this plugin, it seems to have given me hope. I would like to purchase this plugin, but I am unsure if it can help with my particular issue. Simply put, I have several VR devices which do not have SIM cards and do not have direct USB connectivity to access the internet. Their only means of connecting to the internet is through routers in the area, which are sometimes unstable and can lose their ability to connect to the internet. Even when they emit WIFI signals, they cannot access the internet, It can be understood as connecting to a hotspot from a phone without a SIM card..
    I would like to know if this plugin can help me with the following:

    1. Can I always detect the current network status, such as whether it can access the internet, cannot access the internet, whether WIFI is enabled or disabled, etc.?
    2. Can I customize some website URLs and check their status using the plugin to know the current network status?
    Thank you very much."