What's the difference between -
AccountManager accountManager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
and
AccountManager accountManager =Accountmanager.get(context)
What should i use when-
1.Retrieving list of already created accounts in device
2.Adding my app's account to device
If you look into
Accountmanager.get(context)you'll see that it's basically a shortcut to first option with null check: