adjust / flutter_sdk

This is the Flutter SDK of
MIT License
59 stars 49 forks source link

Pausing handlers due to SDK being disabled. #120

Closed temaand1 closed 1 year ago

temaand1 commented 1 year ago

On android, during the session, we saw "Pausing handlers due to SDK being disabled" message in the logs. and Adjust will stop transmitting events to the server. We don't use Adjust.setEnabled(false) in our code, it happens by itself.

uerceg commented 1 year ago

Hello there @temaand1,

Could it be that you're trying to run tests with the GDPR forgotten device?

temaand1 commented 1 year ago

Hey @uerceg, Yes, before the tests, I delete the application from the device and then click Forget device in Test console.

The problem is solved by the fact that we added a check before each event (Adjust.IsEnabled() and if it's return false we call Adjust.setEnabled(true)). With these changes, events come as needed, but I wonder why this is happening and whether it will affect anything else.

uerceg commented 1 year ago

Can you maybe run the test where you're gonna install and run your app with the Adjust SDK being set in sandbox environment (and log level set to verbose) and then do this test where you're getting this message? Just to see what's actually happening in this case. Also feel free to omit any sensitive data from the logs (app / event token(s), whatever you feel like not sharing).

temaand1 commented 1 year ago

@uerceg Sure, here it is. verbose.txt

uerceg commented 1 year ago

Thanks for the logs. In theory the line you're seeing is originating from here. And that can happen only if one would make Adjust.setEnabled(false); method call.

According to what you wrote here it seems like you're gonna engage in re-enabling of the SDK which, yes, it is definitely a prerequisite in order for SDK to be able to track events (if one attempts to track events with SDK being disabled, they are dropped, not even queued).

Not sure how much in depth you wanna go, but I'm curious what's the use case you are trying to solve with having such a usage of calls to setEnabled and isEnabled methods?

temaand1 commented 1 year ago

@uerceg Understood. Thank you for response.

If we talking about isEnabled and setEnabled we added this check to make sure we don't lose events while we figure out what's causing the SDK to shut down.

uerceg commented 1 year ago

I see. 👍 Technically, there are only 2 things that can lead to that scenario:

  1. Explicit call made to Adjust.setEnabled(false); method or
  2. A call made to Adjust.gdprForgetMe(); method where your user has been forgotten on our backend and in case you ever try to send anything from your app from that device, backend would not track that and it will inform SDK that that device is opted out of tracking and SDK will disable itself.