-1

I am using android account manager for my app. It allows multiple accounts and every account has it's own specific data.

What I want to know is;

  • How to determine which account is being used by account manager
  • Is there a way to set specific account in account manager as current one

I'll be using content provider (single class for multiple tables) with syncAdapter to Upload/Download data from a Laravel REST API.

Ali Jibran
  • 343
  • 6
  • 15
  • Read http://developer.android.com/reference/android/accounts/AccountManager.html . There are plenty of guides out there with examples on how to add . The first results that google returns is http://blog.udinic.com/2013/04/24/write-your-own-android-authenticator/ . – RocketRandom Feb 08 '16 at 10:49
  • Also see http://stackoverflow.com/questions/2720315/what-should-i-use-android-accountmanager-for . Most of the basics are well documented here. If you have specific question then please update. – RocketRandom Feb 08 '16 at 10:57
  • I just want to know, how to determine which account is being used in multi accout app. Rest my app is working fine with authenticator/syncadapter/content provider. – Ali Jibran Feb 08 '16 at 15:00
  • Which account is being used where ? The AccountManager just provides APIs to manage accounts. There is no concept of current or default for it – RocketRandom Feb 09 '16 at 08:40
  • IN Application Where else? Suppose. I have 2 gmail accounts. When i access the app. it shows me both accounts . I select one of them . THen it loads emails related to that specific account. I want to do the same, as users of my app has access to different data. So when some user makes a choice of its accout i can access the name of the account myself. but do i have programmatically change the db/user files etc. Thats why i want to know if there is a way to set/get the Current account being used. – Ali Jibran Feb 09 '16 at 11:00
  • Ok. it means , after validating the account being picked by user, i must change the files myself. – Ali Jibran Feb 09 '16 at 11:01
  • the data should all the there always. you need to query appropriately based on your UI selection. The `AccountManager` is not going to do anything about it – RocketRandom Feb 10 '16 at 07:31

1 Answers1

0

Based on the information and clarification by @RocketRandom , it is clear that Account Manager just provides the service. The user/app developer should work out the proper way to handle the accounts.

For my specific problem (Multi User Login), i present user with a selection list(Custom) which allows me to pass on specific user data to SyncAdapter, which in turn load the account related Sqlite db (I am using separate db for each user).

Ali Jibran
  • 343
  • 6
  • 15