Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AmplitudeClient.setOptOut Doesn't Work #381

Open
gusuly0rum opened this issue Jul 13, 2023 · 5 comments
Open

AmplitudeClient.setOptOut Doesn't Work #381

gusuly0rum opened this issue Jul 13, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@gusuly0rum
Copy link

gusuly0rum commented Jul 13, 2023

Expected Behavior

Calling amplitudeClient.setOptOut(true) should make amplitudeClient.isOptedOut return true.

Current Behavior

Calling amplitudeClient.isOptedOut always returns false despite calling amplitudeClient.setOptOut(true).

Images

Amplitude client is initialized as such

@Provides
@Singleton
fun provideAmplitudeClient(): AmplitudeClient {
    return Amplitude.getInstance()
        .setLogLevel(Log.VERBOSE)
        .setFlushEventsOnClose(false)
        .setOptOut(true)
}
image image image

Environment

  • SDK Version: v2.38.3
  • Android API Level: API 33
  • Device: Pixel 4 Emulator
@gusuly0rum gusuly0rum added the bug Something isn't working label Jul 13, 2023
@gusuly0rum gusuly0rum changed the title AmplitudeClient.setOptOut Doesn't Work AmplitudeClient.isOptedOut Always False Jul 13, 2023
@gusuly0rum gusuly0rum changed the title AmplitudeClient.isOptedOut Always False AmplitudeClient.setOptOut Doesn't Work Jul 13, 2023
@yuhao900914
Copy link
Contributor

Hi @gusuly0rum,
Thanks for choosing Amplitude. The setOptOut still works fine. The issue is that the isOptedOut return value is incorrect. We will fix this issue soon.

@yuhao900914
Copy link
Contributor

@gusuly0rum
After investigation, this bug is caused by the setOptOut is executed in Runnable at here. All runnable will be executed in order, this makes sure the logEvent happens after setOptOut will get the correct optOut value. But since the isOptOut get the optOut value immediately, it may happen before setOptOut.
Again, the setOptOut still works fine. The issue is that the isOptedOut return value might be incorrect.

Since this SDK is in Maintenance mode. We highly recommend you upgrade your SDK to our latest android SDK. It's more reliable and has better performance.

@gusuly0rum
Copy link
Author

@yuhao900914 Thanks for letting me know. Yes we want to upgrade to the new SDK soon but there are some features not supported.

@justin-fiedler
Copy link
Contributor

Thank you @gusuly0rum. What features do you need that are missing in the new SDK?

@gusuly0rum
Copy link
Author

gusuly0rum commented Jul 17, 2023

Hello seems like it is missing two things:

  1. Setting isOffline (true/false) on the amplitude object
  2. Dynamically changing the value of setOptOut (true/false) after initializing the amplitude object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants