I want to retrieve token via Account Manager classes. Here is sample code that works for twitter but not for facebook plz help me.
public class AccountMana
Call AccountManager.getAccountsByType(null)
to retrieve all accounts, and check the returned account data includes the information you need. It may simply not be exposed.
Try calling AccountManager.blockingGetAuthToken
instead. Also, make sure your manifest has the USE_CREDENTIALS
permission set correctly.
You can see this discussion How to retrieve an Facebook-AuthToken from the accounts saved on Android
But I would also suggest Facebook SDK
with offline access permission(This permission makes the access token returned by the OAuth endpoint long-lived, otherwise auth token is valid only for 1 hour.)