Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:35:15+00:00 2026-05-27T02:35:15+00:00

I want to store some simple data – an alarm time and some booleans

  • 0

I want to store some simple data – an alarm time and some booleans – in a way that survives device power off. I’ve been trying with sharedPreferences, but the data gets lost when I reboot the phone (it survives okay if the phone stays on).

I’ve read the docs and scanned this site as well as others, but I can’t find a definitive answer to whether sharedPreferences are this persistent.

I could store the values using SqlLite or a file, but I just wanted to know if I’m maybe doing something wrong before I write any unnecessary code.

Here are some code snippets:

public static final String ALARM_PREFERENCES = "AlarmPrefs";
public static final String ALARM_PREFERENCES_VIBRATE = "AlarmVibrate"; // Boolean

...

prefs = getSharedPreferences(ALARM_PREFERENCES, MODE_PRIVATE);

...

mVibrate.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        Editor editor = prefs.edit();
        editor.putBoolean(ALARM_PREFERENCES_VIBRATE,mVibrate.isChecked());
        editor.commit();
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:35:16+00:00Added an answer on May 27, 2026 at 2:35 am

    SharedPreferences are persistent across phone boots. Your code for saving the prefs looks ok too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I store some data in MySQL and want to filter out rows that match
Is there some simple way in PyQt to store data from QTableWidget to some
I want to use ARC in my simple class where I store some values
I want to store some data during my site viewing. Sometime i need to
Is this possible? Situation is that I want to store some XML in my
I want to temporary store some mapping data. The mapping is one to one.
Building a relatively simple website, and need to store some data in the database
I have a relatively simple case. I basically want to store data about links
I want to utilise some form of simple encryption that is reasonably secure but
Say, I have a pretty simple Java application that needs the way to store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.