user3898539
user3898539

Reputation:

How the SharedPreferences works and is it safe

I'm going to use the SharedPreferences Keys to store my app informations so when I open the app again after onDestroy the information will still the same.

I'm just wondering is it safe to use SharePreferences ? I mean is there a way to hack or get the KEYS from the SharePreferences ?
and does all Android Platforms have the SharePreferences ?

thanks .

Upvotes: 1

Views: 3721

Answers (2)

Alexander Sidikov Pfeif
Alexander Sidikov Pfeif

Reputation: 2435

sharedPreferences arent safe.. sharedPreferences should just store config/setting-data not encrypted..

if u want to store critical data - you have to write it encrypted in a dataBase/sharedPrefs

btw .. http://android-developers.blogspot.de/2013/02/using-cryptography-to-store-credentials.html

Upvotes: 3

yunik
yunik

Reputation: 53

You shouldn't store any unencrypted valuable information(passwords, private user information etc.) in SharedPreferences. SharedPreferences are just plain XML files in app directory on internal storage. If you need to store smth private - you definitely need to encrypt it first.

Upvotes: 3

Related Questions