hawk
hawk copied to clipboard
IllegalStateException: SharedPreferences in credential encrypted storage are not available until after user is unlocked
Please try to fill all questions below before submitting an issue.
- [x] On which android versions do you have this issue? : 8.1.0
- [x] On which phones do you have this issue? : Google Pixel XL
- [x] Which hawk version are you using? : 2.0.1
- [x] Does this issue happen always or is it flaky? : always
- [x] 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?
Hi! Is any solution?
You should wait until user unlock or use device protected storage
What is an example for device protected storage?
@KrazyKode101 google android device protected storage