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

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

Open
5 of 7 tasks
nikedlab opened this issue Aug 29, 2018 · 4 comments

Comments

@nikedlab
Copy link

nikedlab commented Aug 29, 2018

Please try to fill all questions below before submitting an issue.

  • On which android versions do you have this issue? : 8.1.0
  • On which phones do you have this issue? : Google Pixel XL
  • Which hawk version are you using? : 2.0.1
  • Does this issue happen always or is it flaky? : always
  • Can you write failing test? : no
  • If it is Hawk.put and Hawk.get issue, can you write down which data you were trying to save and get it back? -
  • Is the data you are trying to save it huge or small? -

The problem is when I tried to access to stored data when device is just started. BootReceiver fired when received <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />, service started with success but after crashed with exception java.lang.IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked
Root of cause is known, storage is crypted until user is not logged in.
Accordingly to https://developer.android.com/training/articles/direct-boot should be created second context with decrypted storage. What I should do in this case? Is it required to write own Storage implementation?

@nikedlab
Copy link
Author

Hi! Is any solution?

@k4dima
Copy link

k4dima commented May 22, 2019

You should wait until user unlock or use device protected storage

@karthikts-github
Copy link

What is an example for device protected storage?

@k4dima
Copy link

k4dima commented Mar 14, 2020

@KrazyKode101 google android device protected storage

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

3 participants