Search Unity

Internet Reachability Verifier - Support Thread

Discussion in 'Assets and Asset Store' started by tonic, Jun 19, 2014.

  1. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    NEW in v1.2.0: :D
    WebGL and Facebook platform support.
    • Support for Android 9 security config, where cleartext http traffic is disabled by default (similar to iOS ATS).
    • Compatibility verified up to Unity 2018.3.
    New detection methods: Google204HTTPS, UbuntuHTTPS, MicrosoftConnectTest, MicrosoftNCSI_IPV6, MicrosoftConnectTest_IPV6 (the IPV6 ones only work when the network is IPV6-capable!).
    UnityWebRequest is now used with Unity 2018.3+

    ( Ping @Murcho @Mandelboxed @dasu @rebbort )
     
  2. chaostheorygames

    chaostheorygames

    Joined:
    Jul 10, 2014
    Posts:
    4
    Hi @tonic
    Is there any reason the minimum API level is set so high (Android 8.0, API level 26)?
    We are building a game that requires Android 6.0, API level 23 - have just purchased and implemented your plugin and it is stopping us from building to device.
     
    Indroo likes this.
  3. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @chaostheorygames is that for the included AAR file (containing network security config)?
    If so, it's probably my mistake and there's no reason to set it that high. I can't verify this right now, but I will soon!
     
    Indroo likes this.
  4. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @chaostheorygames I think that it's because of the aar file. I sent you privately a new one, hoping you can test if it works with your build.
     
  5. chaostheorygames

    chaostheorygames

    Joined:
    Jul 10, 2014
    Posts:
    4
    Thank you that fix worked! Much appreciated.
     
  6. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    Version 1.2.1 is released and it lowers the minimum / target SDK requirements.
     
  7. NandhuVicky

    NandhuVicky

    Joined:
    Oct 1, 2018
    Posts:
    2
    @tonic
    Question regarding IRV feature

    Does IRV have any feature like slow internet connectivity monitor that detects slow internet connection at runtime?
     
  8. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    Hi @NandhuVicky, thanks for the question. There's no any kind of speed monitoring involved.
     
  9. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    19
    Hi @tonic
    I have problems with checking the internet on Android 9. I have the latest version of your plugin, but it doesn't work on Android 9.

    P.S.: iPhone works. Other Android versions work. Unity 2018.2.
     
  10. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @Shefich Since proper Android 9 support was added in version 1.2.0, could you provide more details?

    - which version of IRV you're using
    - what Unity version you're using
    - what Android SDK version you are using (and targeting what version)
    - what IRV detection method you're using - default by platform, or one of the others (which one / provide your custom url if you use custom method, you can send that in private message)
    - did you notice anything specific when monitoring adb logcat
     
  11. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    19
    @tonic
    - IRV 1.2.1
    - Unity 2018.2.21 f1
    - Minimum Android API 4.1
    - Target automatic (highest installed) Installed highest = 9.0
    - On Android 9 OneUI 1.0 doesn't work
    - On Android 8.0.0 works
    - IRV detection Default by platform
    - adb logcat:
    Cleartext HTTP traffic to clients3.google.com not permitted

    Upd:
    Adding android:usesCleartextTraffic="true" to the AndroidManifest fixes the problem, but I have no idea why your network security configuration file (aar) doesn't work.
     
    Last edited: Apr 26, 2019
  12. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @Shefich, thanks!

    There's a few things we could try:

    1. Update to Unity 2018.3 or newer. If you can't upgrade, then alternatively please try to enable UnityWebRequest usage: Find #define IRV_USE_WEBREQUEST in InternetReachabilityVerifier.cs, remove the preceding #if and the next #endif. (This step is bit of a wild guess, and should not affect...)

    2. Make sure this file is in your project and not somehow omitted:
    Assets/InternetReachabilityVerifier/Plugins/Android/InternetReachabilityVerifier_NetworkSecurityConfig.aar
    Also click that file in Unity Project window and make sure in Inspector that the Android platform is [✓] Checked. This file is crucial for the Android 9 support.
    I'm not sure, but it's possible some version of unity would want that file to in this location instead, so you could try it:
    Assets/Plugins/Android/InternetReachabilityVerifier_NetworkSecurityConfig.aar
     
  13. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    19
    @tonic I've tried these.

    1. Can't update because of unstable unity release. At least for some SDKs.
    I removed #if #endif, to define IRV_USE_WEBREQUEST, but it didn't help.

    2. I doubled checked checkbox for InternetReachabilityVerifier_NetworkSecurityConfig.aar
    Also I tried to move it to "Assets/Plugins/Android/". It didn't help also. I have some other SDKs in the project and their plugins works good from separate folders (not the main "Plugins" folder).
     
  14. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @Shefich I'll try to test with the same Unity version. But I'm starting to suspect this is an issue which only happens with certain Unity or Android SDK version, and if so, the only remedy may be to upgrade either one.
     
  15. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @Shefich, yes, just confirmed the cause is that Unity 2018.2.21f1 just doesn't recognize yet the Android 9 platform even if a capable SDK is installed.

    So you either have to upgrade to newer Unity version, or alternatively accept using the android:usesCleartextTraffic="true" workaround in manifest.

    Player Settings Android Target API level in Unity 2018.2.21f1:
    It doesn't let you pick higher than 8.1 'Oreo' (API level 27), so that's highest also for "Automatic".
    android_u2018221.png

    Player Settings Android Target API level in Unity 2018.3.0f2:
    Here Unity lets you pick Android 9.0 'Pie' (API level 28), required for the network security config to work.
    android_u201830.png
     
  16. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    19
    @tonic thank you for the confirmation.
     
  17. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    70
    Hi @tonic
    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.
     
  18. tonic

    tonic

    Joined:
    Oct 31, 2012
    Posts:
    379
    @Jochanan, thanks for the question.

    Internet Reachability Verifier (IRV) does not make a distinction between Carrier and WiFi/Local network. It uses Application.internetReachability to check when network is something else than "NotReachable" (after that passes, it makes a small actual network request to test if the result is what's expected).

    So, to answer your questions:

    Does your asset determines, when user switches from WiFi to Carrier Network internet on mobile phone?

    IRV asset does not determine switch between WiFi/Carrier Network.​

    I do not want do do the test every Update to check it out. Is there a reliable way, hot to figure it out?

    I do not know if there's better way with Unity API than to poll Application.internetReachability. You might be able to create platform-specific implementation to get a notification instead of polling, but that's out of scope for IRV asset.​

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

    IRV is asset is "compatible" with Application.internetReachability, and even uses it internally. But, IRV doesn't exactly help you any way to detect switch between WiFi/Carrier Network. Actually, it does not monitor "lost connectivity" at all -- that's an "error situation" you're supposed to detect with the networking API you're using for actual traffic, and whenever that happens, you can then ask IRV to verify the connectivity again (and wait for notification about that).
     
    Jochanan likes this.