Sitemap
ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Follow publication

Press enter or click to view image in full size

Encrypted Preferences in Android

3 min readOct 13, 2019

--

Storing data in SharedPreferences is so quick and comfortable. It’s also easy for malicious people to have a look at the data stored in SharedPreferences… so go have to be careful about what you put in there, and might need to start thinking about way to store data in an encrypted format.

For small amounts of data which don’t justify the usage of a db engine such a SqlCipher, our options were limited to:

It has been in the works for a while, but now we have a proper and official solution. Even if it’s still alpha2 it already has been working pretty well for some time in one of my projects, all welcome EncryptedSharedPreferences to your min-sdk 23+ projects.

Let’s jump to an example of how to use it:

EncryptedSharedPreferences example

Min-sdk

As of today, 23 (Android 6.0)

--

--

ProAndroidDev
ProAndroidDev

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Responses (10)