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

Android 11 IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked #741

Open
kozyrevsergey89 opened this issue Dec 14, 2020 · 2 comments

Comments

@kozyrevsergey89
Copy link
Contributor

Hi,

I'm using segment version 4.8.2 and got a crash on Android 11 (no issues on previous OS versions).

java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:494) at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:479) at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:188) at com.segment.analytics.internal.Utils.getSegmentSharedPreferences(Utils.java:309) at com.segment.analytics.ValueMap$Cache.<init>(ValueMap.java:395) at com.segment.analytics.ProjectSettings$Cache.<init>(ProjectSettings.java:76) at com.segment.analytics.Analytics$Builder.build(Analytics.java:1378)

This happens when we schedule some work with WorkManager and it executes after device is booted but user hasn't entered credentials for the first time. Job execution can not be moved to a later stage, and we still need to send analytics.

@aloz77
Copy link

aloz77 commented Dec 17, 2023

Still running into this issue with ACRA 5.11.3 when the Application is starting on LOCKED_BOOT_COMPLETED and calling ACRA.init(). If there is no general solution, is there a chance to add a method to ACRA.init() to set the context for the preference storage manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants