7

In my project want to read and write the data in server depends upon the authentication key(user).

So far I planned to use shared preference to store user authentication key for further communication with server.

Later I came to know "Account manager" by reading this tutorial:

I have little confuse to use account manager or sharedpreference.

I feel little difficult to understand accountmanager.

Can any one guide which method suits for my project.

Any tutorial for account manager.?

Any other suggestions...?

Thanks in advance.

RevanthKrishnaKumar V.
  • 1,779
  • 1
  • 19
  • 33
Amir john
  • 940
  • 1
  • 10
  • 24

2 Answers2

5

I would recommend you to think about your requirement first. If authentication is like google+, Facebook and Twitter then I would suggest you to use AccountManager

AccountManager: This centralized registry of user's online account. Account Manager is capable of storing the OAuth token and does the job for all Google Apps in Android.

SharedPreferences:This is for storing and retrieving small range of data for more this.

Dilip
  • 2,172
  • 5
  • 29
  • 50
  • Though I am using Private account for user only for this application. **Shared preferences** is an solution. – Amir john Oct 16 '14 at 07:08
  • r u using any auth token? What happen if user changes password on another client? If u need to manage this all then U should user Account Manager else SharedPreferences is good – Dilip Oct 16 '14 at 07:17
  • The answer above seems not matching http://stackoverflow.com/a/10890978/3286489, which discourage one to use AccountManager unless one need syncAdapter – Elye May 07 '16 at 13:26
  • @Elye this answer for the above question. I don't know the context which you are talking about. – Dilip May 09 '16 at 11:12
0

You could use Shared Preference. Its easy and effective as well. Read the documentation to know about Shared Preference. Presonally I have used it in many application and it comes really handy.

Pravin Raj
  • 2,269
  • 1
  • 10
  • 12