Questions tagged [sharedpreferences]

SharedPreferences allows you to save and retrieve persistent key-value pairs of primitive data types in Android applications. It can be used either inside a single app or shared between multiple apps.

SharedPreferences allows you to save and retrieve persistent key-value pairs of primitive data types in Android applications. It can be used either inside a single app or shared between multiple apps.

You can learn more about SharedPreferences under the Data Storage section in the Android documentation.

7696 questions
1
vote
2 answers

What is wrong with my Shared preference? It wont remember my selected strokeWidth

I am trying to make a doodle app and im trying to get my selections on strokeWidth carry over to a reboot of the app. I tried the code below, but it doesnt seem to be working. Can someone tell me what im doing wrong or point me in the right…
1
vote
1 answer

Flutter: How to keep the same Screen before closed it?

I want to keep the view or session of some screens. For example, if I close the app, I can then go back to the last open screen. I think this is possible using SharedPreferences, but I just know that SharedPreferences is for user data only. I would…
1
vote
1 answer

Path to "device protected storage" or "direct boot" sharedprefs file

Starting with Android Nougat, I used the following code to move the sharedprefs location from the "credential encrypted storage" to "device encrypted storage" so that I can access it before the user unlocks the device (otherwise known as…
Flyview
  • 1,899
  • 1
  • 28
  • 46
1
vote
1 answer

Shared preference : Value not updated in the real time or immediately

I am trying to implement a feature where the user provides input on one screen and the data is stored locally (Shared Preferences) and as soon as the user gets back to another screen or pops back, the data should be updated to that screen…
ashish rana
  • 185
  • 7
1
vote
0 answers

flutter shared_preferences shared over all devices of user using drive/icloud or NSUbiquitousKeyValueStore for Android

I'm wondering if there is any way to allow the user to backup the shared_preferences to drive or icloud? I save some data from a questionnaire to shared preferences. These data are effecting the content that is available for the user. Target: If the…
1
vote
0 answers

SharedPreferences. how do I make sure that the account remains the same?

I have already created users, a name and password in my database. Then the user name is passed to the next activity. And with the next activity from the menu, you can click the logout button and it should display the registration window. But nothing…
S S
  • 11
  • 2
1
vote
0 answers

How can I handle Vector Assets in SharedPreferences? (Android/Java)

I've been developing an Android app that allows users to track budget spending records. Since this is a budget spending tracker, I want users to select their currencies. In this case, I have three currencies: US Dollar, Japanese Yen, and Euro. To…
1
vote
1 answer

Insecure Local Storage in Android

I'm creating a native application , where I used to save some values in my shared Preferences. But saving values to shared preferences seems to be insecure of security reasons. How can we provide security to values stored in shared Preferences? The…
I'm Coder
  • 125
  • 2
  • 13
1
vote
0 answers

Solving Unexpected character (at character 1)

I am trying to assign value to the sharedPreference sharedPreferences.setString('destination', 'supermarket'); But I'm having the following error. Unhandled Exception: FormatException: Unexpected character (at character 1) E/flutter ( 3073):…
simsim
  • 155
  • 1
  • 11
1
vote
1 answer

Can SharedPreferences/Encrypted SharedPreferences be accessed from another app?

I'm working on an app which stores sensitive data with encrypted shared preferences. I came across some questions regarding that if it is possible to be accessed from another app. Some of the answers stated that to prevent SharedPreferences from…
1
vote
1 answer

Can't use SharedPreferences in intended activity

There are two classes MainActivity and PickTimeForNotif in my project. In MainActivity getSharedPreferences works just fine, i can save my data and get it back. In PickTimeForNotif, however, the same method seems to do nothing. Here's my simplified…
gydroponch
  • 13
  • 5
1
vote
0 answers

Save firebase background message locally in flutter

Hi guys I'm working on app where I've to save FCM in mobile locally. It's working fine in foreground message but it's not working on background and terminate state.
1
vote
2 answers

Shared Preferences is not working on release mode even with --no-shrink

You probably saw this question before, but I am still not able to find an answer. Everything works fine in debug mode, but when trying to build the app in release mode, the shared preferences don't work. Here is what I've tried flutter build apk…
Jay
  • 231
  • 1
  • 12
1
vote
0 answers

Why do we need to encrypt local persistent data in Android?

In release build, the default value of android:debuggable=false, which make the package not debuggable run-as: package not debuggable. Therefore, we cannot access any data in the package. So, my question is if we cannot access the package data, e.i…
1
vote
1 answer

Need to save and retrive data when app is closed and reopened with SharedPreferences

I need to save and retrive data when app is closed and reopened with SharedPreferences. Basically when i close the app the language preference is not saved. I would like to know: Should I implement the OnPause method, or should I create a…
Giovanni
  • 512
  • 2
  • 6
  • 23
1 2 3
99
100