How to Encrypt Shared Preferences in Android apps

Last updated April 8, 2021 by Alan Bavosa


Learn the 3 Easy Steps to encrypt Android Shared Preferences in Android apps – no code or coding.

What Are Shared Preferences in Android apps?

In Android app development, Shared Preferences are used to keep track of commonly accessed user and application preferences in Android apps. Preferences are used mainly to create a sense of persistence and personalization for mobile users to improve the user experience. Shared Preferences are stored as plain-text XML key/value pairs inside Android apps and can be retrieved by other apps and systems.

Why Encrypt Shared Preferences?

Preferences can be any kind of text-based data which may include information about users that is highly personal, private or sensitive. For example, preferences can be used to display a screen that contains a patients’ personal health data which is saved when the application closes and brought back when the app opens again, to provide vital real-time information about the patient to various members of the patient’s care team.  The use of app preferences is very broad and flexible, and there’s no restriction on the type of information that can be stored in preferences and retrieved by other resources. Furthermore, Shared Preferences are stored as plain-text data (unencrypted) by default, which makes them a valuable area for hackers to target with ease.  For this reason, it makes sense to Encrypt Shared Preferences in Android apps, so that this data cannot be easily accessed by attackers.

How to Encrypt Shared Preferences in Android apps using Appdome

Learn how to encrypt Android Shared Preferences quickly and easily with no code or coding.

Appdome is a no-code mobile security and development platform that enables anybody to add a wide variety of mobile app security features, SDKs, and APIs to Android and iOS apps – no code or coding required.

Using Appdome, there are no development or coding prerequisites. Customers simply upload any Android or iOS app, select their desired security features, and click “Build My App”. The Appdome technology automatically builds the required security features into the app, alongside all relevant standards, frameworks and more – all with no development at all.

3 Easy Steps to Encrypt Shared Preferences in Any Android app

Start by adding a mobile app to your Appdome account. If you don’t have an Appdome account, click here to create an account.

  1. Under the Build tab, select Security, then enable Data at Rest Encryption
  2. Click on the toggle to enable Encrypt In-App Preferences
  3. Click Build My App

encrypt app preferences in android and ios apps

Using Appdome to Encrypt Android Shared Preferences will encrypt all configuration files under/shared-prefs in Android apps. Using Appdome to encrypt app preferences greatly enhances the security of the app from anyone trying to gain unauthorized access to application secrets and other sensitive data stores in mobile app preferences.

The technology behind Build My App has two major elements – (1) a microservice architecture filled with 1000s of code sets needed for mobile integrations, and (2) an adaptive code generation engine that can recognize the development environment, frameworks, and methods in each app and match the app to the relevant code-sets needed encrypt in-app preferences in a mobile app in seconds.

Congratulations! When your build is complete, you will see the notice below.

 Prerequisites for Using Encrypt Android Shared Preferences

In order to use Appdome’s no-code platform to encrypt in-app preferences you’ll need:

After Building Your App on Appdome

After successfully building the app,  the app needs to be signed in order to deploy it.  Optionally,  you can also brand or customize apps using Appdome. Read this KB to learn how to sign, customize, brand, and apps using Appdome. . It explains both optional steps and required steps.

How Do I Learn More?

Read this KB article to learn how to Encrypt iOS app preferences and NSUserDefaults in iOS apps.

To learn more about Appdome encryption, read this article on No-code Mobile Data-at-Rest Encryption.

Request a demo at any time.

If you have any questions, please send them our way at or via the chat window on the Appdome platform.

Thank you!

Thanks for visiting Appdome! Our mission is to make mobile security easy. We hope we’re living up to the mission with your project. If you don’t already have an account, you can sign up for free.

Have a question?

Ask an expert

HilaMaking your security project a success!