No GeoIP on Flush because of no internet and Crash

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);

@LuftetarMan What version of the Analytics package are you using? Did the Try/Catch work for you?

version 4.0.0, yes try/catch worked for me.

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?

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.

Hi Everyone!

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

https://discussions.unity.com/t/872830

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.

Thanks for the feedback, again! We are discussing possible improvements here as we speak.

1 Like

@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.

The same happens (i think) if there is internet connection but the analytics were not initialized correctly like I describe it in this thread:
https://forum.unity.com/threads/geoip-request-unreliable.1385154/

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.