Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question No GeoIP on Flush because of no internet and Crash

Discussion in 'Unity Analytics' started by LuftetarMan, Jun 1, 2022.

  1. LuftetarMan

    LuftetarMan

    Joined:
    Sep 25, 2015
    Posts:
    12
    When i call that AnalyticsService.Instance.Flush() while internet is off i get this error:

    ConsentCheckException: The required consent flow cannot be determined. Make sure GeoIP was successfully called.


    If im not wrong as i read that without internet even Unity write events on disk then send them when internet is on. So if internet off then No GeoIP. Because this unity cant give desicition for collecting data. And throw an error. But this error crush my game. yes i will test with 'try catch' .

    And 'Managing Data Privacy and Consent' documentation wasn't enough for me to understand how to use '
    Complying with PIPL' on example code i dont know where to call CheckUserConsent .
    then calling AnalyticsService.Instance.ProvideOptInConsent(consentIdentifier, true/false);

     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @LuftetarMan What version of the Analytics package are you using? Did the Try/Catch work for you?
     
  3. LuftetarMan

    LuftetarMan

    Joined:
    Sep 25, 2015
    Posts:
    12
    version 4.0.0, yes try/catch worked for me.
     
  4. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    189
    Hello @LuftetarMan

    I can confirm in my initial testing that you are indeed correct about the ConsentCheckException: The required consent flow cannot be determined. Make sure GeoIP was successfully called. Error message that gets thrown when there is no internet connection as is expected.

    This error is a warning that the consent check failed, you can catch the exception how you would like, just like in the sample documentation.

    I confirmed this both in editor and on Android, however I did not experience a crash.

    Can you help me reproduce the steps to get a crash.

    • Did the Crash occur in the Editor or in a Build?

    • What device/'s were you using when your game crashed?

    • What version of unity are you using?
    • Could you confirm your build settings if you left them as default or if you changed them?

    • Can you send the Manifest.json file as this will help us confirm what packages are installed?

    • Can you also attach a crash log?
     
    Last edited: Jun 7, 2022
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes I see the same behavior. I have let the team know. Update - This is expected behavior. Your Try/Catch is the correct approach. Sorry for the confusion.
     
  6. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    674
    Hi Everyone!

    I hit this issue early on after switching to the new analytics (which Jeff kindly helped out with)...

    https://forum.unity.com/threads/unity-analytics-new-in-offline-mode.1244206/

    A try\catch will work around the issue, but tbh offline support for the new analytics could definitely do with some improvement (both functional and usability) long term.

    Currently I've implemented some workarounds (to issues like this) in my own framework, but it can't deal with all scenarios. The last message in the other thread explains a scenario where all events are lost if a session never initialises (i.e. being online) even though the new analytics should be capturing messages offline.

    That said, I haven't tested these scenarios on the latest version, so maybe they've already been addressed.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Thanks for the feedback, again! We are discussing possible improvements here as we speak.
     
    PeachyPixels likes this.
  8. mylastggeast

    mylastggeast

    Joined:
    Jun 14, 2021
    Posts:
    47
    @JeffDUnity3D
    Hello!
    Did the offline workflow receive any improvement or rework in recent updates?
    I am using 4.2.0 but I cannot see any change wrt what's been discussed in this thread.
     
  9. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    361
  10. anthony_7

    anthony_7

    Joined:
    Jan 28, 2023
    Posts:
    1
    If I'm not mistaken, I've read that even Unity writes events to disc before sending them when the internet is available. So, no GeoIP if the internet is down. Because this unity cannot provide a decision for data collection. and make a mistake. But this mistake kills my game. I will test with "try catch," of course.