Yup, the returning of false was a bug and you'll find it fixed in a future
update.
Re: storing credentials. Is there any way you can get by without storing
the actual password? Perhaps use the password to get some token from the
service? If you absolutely have to store the password, I'd suggest at least
encrypting it with a key that's hard coded in your app (yes, this is still
not secure, but at least it won't be stored plaintext).
jason
On Tue, Nov 4, 2008 at 1:51 PM, polo777 <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> Almost everything is in the title. I am trying to save username and
> password into the sharedpreferences file. I used the little function
> below to do so:
> Everything works (The data are written correctly, I can read them
> afterward) but the editor.commit() always returns false even though
> the commit works(). Is that a bug?
>
> private void saveCredential(String username, String password)
> {
> // Restore or Create preferences if it doesn't exist
> SharedPreferences settings =
> getSharedPreferences(Common.PREFS_NAME,
> MODE_PRIVATE);
> // We need an Editor object to make changes in the
> preferences file
> SharedPreferences.Editor editor = settings.edit();
> // Then we add the login and the password
> editor.putString(Common.PREF_USERNAME,username);
> editor.putString(Common.PREF_PASSWORD,password);
> // We don't forget to commit our edits
> if (editor.commit())
> Log.v(DEBUG_TAG, "(Username: " + username + ") ;
> (password : " + password + ") correctly added into file " +
> Common.PREFS_NAME);
> else
> // not good
> }
>
> If anyone has a solution, an answer, anything, that would be great ;)
>
> Also in term of security, is that fine? Should I store the credential
> into a database or anything else?
>
> Thanks a lot.
> Polo
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---