Android SDK Version


public class LoginManager
This class manages login and permissions for Facebook.
Field Summary
Modifier and TypeFieldDescription
private static volatile LoginManagerinstance
private LoginBehaviorloginBehavior
private DefaultAudiencedefaultAudience
private StringauthType
private StringmessengerPageId
private booleanresetMessengerState
private booleanisFamilyLogin
private booleanshouldSkipAccountDeduplication
Method Summary
Modifier and TypeMethodDescription
static LoginManagergetInstance() Getter for the login manager.
LoginBehaviorgetLoginBehavior() Getter for the login behavior.
LoginManagersetLoginBehavior(LoginBehavior loginBehavior) Setter for the login behavior.
DefaultAudiencegetDefaultAudience() Getter for the default audience.
LoginManagersetDefaultAudience(DefaultAudience defaultAudience) Setter for the default audience.
StringgetAuthType() Getter for the authType
LoginManagersetAuthType(String authType) Setter for the authType
LoginManagersetMessengerPageId(@Nullable() String messengerPageId) Setter for the messengerPageId
LoginManagersetResetMessengerState(boolean resetMessengerState) Setter for the resetMessengerState.
booleanisFamilyLogin() Determines whether we are using the cross Family of Apps login experience
booleangetShouldSkipAccountDeduplication() Determines if we should skip deduplicating account during x-FoA login.
LoginManagersetShouldSkipAccountDeduplication(boolean shouldSkipAccountDeduplication) Setter for whether we are skipping deduplicating account during x-FoA login.
voidresolveError(Activity activity, GraphResponse response) Starts the login process to resolve the error defined in the response.
voidresolveError(Fragment fragment, GraphResponse response) Starts the login process to resolve the error defined in the response.
voidresolveError(Fragment fragment, GraphResponse response) Starts the login process to resolve the error defined in the response.
voidregisterCallback(CallbackManager callbackManager, FacebookCallback<LoginResult> callback) Registers a login callback to the given callback manager.
voidunregisterCallback(CallbackManager callbackManager) Unregisters a login callback to the given callback manager.
LoginTargetAppgetLoginTargetApp() Getter for the login target app.
LoginManagersetLoginTargetApp(LoginTargetApp targetApp) Setter for the login target app.
LoginManagersetFamilyLogin(boolean isFamilyLogin) Setter for whether we are using cross Family of Apps login
voidlogOut() Logs out the user.
voidretrieveLoginStatus(Context context, LoginStatusCallback responseCallback) Retrieves the login status for the user.
voidretrieveLoginStatus(Context context, long toastDurationMs, LoginStatusCallback responseCallback) Retrieves the login status for the user.
voidlogInWithReadPermissions(Fragment fragment, Collection<String> permissions) Logs the user in with the requested read permissions.
voidlogInWithReadPermissions(Fragment fragment, Collection<String> permissions) Logs the user in with the requested read permissions.
voidlogInWithReadPermissions(Activity activity, Collection<String> permissions) Logs the user in with the requested read permissions.
voidlogInWithConfiguration(Fragment fragment, @NonNull() LoginConfiguration loginConfig) Logs the user in with the requested configuration.
voidloginWithConfiguration(Activity activity, @NonNull() LoginConfiguration loginConfig) Logs the user in with the requested configuration.
voidreauthorizeDataAccess(Activity activity) Reauthorize data access
voidreauthorizeDataAccess(Fragment fragment) Reauthorize data access
voidlogInWithPublishPermissions(Fragment fragment, Collection<String> permissions) Logs the user in with the requested publish permissions.
voidlogInWithPublishPermissions(Fragment fragment, Collection<String> permissions) Logs the user in with the requested publish permissions.
voidlogInWithPublishPermissions(Activity activity, Collection<String> permissions) Logs the user in with the requested publish permissions.
voidlogIn(Fragment fragment, Collection<String> permissions) Logs the user in with the requested permissions.
voidlogIn(Fragment fragment, Collection<String> permissions, String loggerID) Logs the user in with the requested permissions.
voidlogIn(Fragment fragment, Collection<String> permissions) Logs the user in with the requested permissions.
voidlogIn(Fragment fragment, Collection<String> permissions, String loggerID) Logs the user in with the requested permissions.
voidlogIn(FragmentWrapper fragment, Collection<String> permissions) Logs the user in with the requested permissions.
voidlogIn(FragmentWrapper fragment, Collection<String> permissions, String loggerID) Logs the user in with the requested permissions.
voidlogIn(Activity activity, Collection<String> permissions) Logs the user in with the requested permissions.
voidlogIn(FragmentWrapper fragment, @NonNull() LoginConfiguration loginConfig) Logs the user in with the requested login configuration.
voidlogIn(Activity activity, @NonNull() LoginConfiguration loginConfig) Logs the user in with the requested configuration.
voidlogIn(Activity activity, Collection<String> permissions, String loggerID) Logs the user in with the requested permissions.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail

getInstance

 static LoginManagergetInstance()
Getter for the login manager.

getLoginBehavior

LoginBehaviorgetLoginBehavior()
Getter for the login behavior.

setLoginBehavior

LoginManagersetLoginBehavior(LoginBehavior loginBehavior)
Setter for the login behavior.
Parameters:
loginBehavior - The login behavior.

getDefaultAudience

DefaultAudiencegetDefaultAudience()
Getter for the default audience.

setDefaultAudience

LoginManagersetDefaultAudience(DefaultAudience defaultAudience)
Setter for the default audience.
Parameters:
defaultAudience - The default audience.

getAuthType

StringgetAuthType()
Getter for the authType

setAuthType

LoginManagersetAuthType(String authType)
Setter for the authType
Parameters:
authType - The authType

setMessengerPageId

LoginManagersetMessengerPageId(@Nullable() String messengerPageId)
Setter for the messengerPageId
Parameters:
messengerPageId - The messengerPageId

setResetMessengerState

LoginManagersetResetMessengerState(boolean resetMessengerState)
Setter for the resetMessengerState. For developers of the app only.
Parameters:
resetMessengerState - Whether to enable resetMessengerState

isFamilyLogin

 boolean isFamilyLogin()
Determines whether we are using the cross Family of Apps login experience

getShouldSkipAccountDeduplication

 boolean getShouldSkipAccountDeduplication()
Determines if we should skip deduplicating account during x-FoA login.

setShouldSkipAccountDeduplication

LoginManagersetShouldSkipAccountDeduplication(boolean shouldSkipAccountDeduplication)
Setter for whether we are skipping deduplicating account during x-FoA login.
Parameters:
shouldSkipAccountDeduplication - Whether we want to opt out account deduplicationexperience in Family of Apps login

resolveError

 void resolveError(Activity activity, GraphResponse response)
Starts the login process to resolve the error defined in the response. The registered logincallbacks will be called on completion.
Parameters:
activity - The activity which is starting the login process.
response - The response that has the error.

resolveError

 void resolveError(Fragment fragment, GraphResponse response)
Starts the login process to resolve the error defined in the response. The registered logincallbacks will be called on completion.
Parameters:
fragment - The fragment which is starting the login process.
response - The response that has the error.

resolveError

 void resolveError(Fragment fragment, GraphResponse response)
Starts the login process to resolve the error defined in the response. The registered logincallbacks will be called on completion.
Parameters:
fragment - The android.app.Fragment which is starting the login process.
response - The response that has the error.

registerCallback

 void registerCallback(CallbackManager callbackManager, FacebookCallback<LoginResult> callback)
Registers a login callback to the given callback manager.
Parameters:
callbackManager - The callback manager that will encapsulate the callback.
callback - The login callback that will be called on login completion.

unregisterCallback

 void unregisterCallback(CallbackManager callbackManager)
Unregisters a login callback to the given callback manager.
Parameters:
callbackManager - The callback manager that will encapsulate the callback.

getLoginTargetApp

LoginTargetAppgetLoginTargetApp()
Getter for the login target app.

setLoginTargetApp

LoginManagersetLoginTargetApp(LoginTargetApp targetApp)
Setter for the login target app.
Parameters:
targetApp - The login target app.

setFamilyLogin

LoginManagersetFamilyLogin(boolean isFamilyLogin)
Setter for whether we are using cross Family of Apps login
Parameters:
isFamilyLogin - Whether we are using cross Family of Apps login

logOut

 void logOut()
Logs out the user.

retrieveLoginStatus

 void retrieveLoginStatus(Context context, LoginStatusCallback responseCallback)
Retrieves the login status for the user. This will return an access token for the app if a useris logged into the Facebook for Android app on the same device and that user had previouslylogged into the app. If an access token was retrieved then a toast will be shown telling theuser that they have been logged in.
Parameters:
context - An Android context
responseCallback - The callback to be called when the request completes

retrieveLoginStatus

 void retrieveLoginStatus(Context context, long toastDurationMs, LoginStatusCallback responseCallback)
Retrieves the login status for the user. This will return an access token for the app if a useris logged into the Facebook for Android app on the same device and that user had previouslylogged into the app. If an access token was retrieved then a toast will be shown telling theuser that they have been logged in.
Parameters:
context - An Android context
toastDurationMs - The duration to show the success toast in milliseconds
responseCallback - The callback to be called when the request completes

logInWithReadPermissions

 void logInWithReadPermissions(Fragment fragment, Collection<String> permissions)
Logs the user in with the requested read permissions.
Parameters:
fragment - The android.support.v4.app.Fragment which is starting the login process.
permissions - The requested permissions.

logInWithReadPermissions

 void logInWithReadPermissions(Fragment fragment, Collection<String> permissions)
Logs the user in with the requested read permissions.
Parameters:
fragment - The android.app.Fragment which is starting the login process.
permissions - The requested permissions.

logInWithReadPermissions

 void logInWithReadPermissions(Activity activity, Collection<String> permissions)
Logs the user in with the requested read permissions.
Parameters:
activity - The activity which is starting the login process.
permissions - The requested permissions.

logInWithConfiguration

 void logInWithConfiguration(Fragment fragment, @NonNull() LoginConfiguration loginConfig)
Logs the user in with the requested configuration.
Parameters:
fragment - The android.support.v4.app.Fragment which is starting the login process.
loginConfig - The login configuration

loginWithConfiguration

 void loginWithConfiguration(Activity activity, @NonNull() LoginConfiguration loginConfig)
Logs the user in with the requested configuration.
Parameters:
activity - The activity which is starting the login process.
loginConfig - The login configuration

reauthorizeDataAccess

 void reauthorizeDataAccess(Activity activity)
Reauthorize data access
Parameters:
activity - The activity which is starting the reauthorization process.

reauthorizeDataAccess

 void reauthorizeDataAccess(Fragment fragment)
Reauthorize data access
Parameters:
fragment - The android.support.v4.app.Fragment starting the reauthorization process.

logInWithPublishPermissions

 void logInWithPublishPermissions(Fragment fragment, Collection<String> permissions)
Logs the user in with the requested publish permissions.
Parameters:
fragment - The android.support.v4.app.Fragment which is starting the login process.
permissions - The requested permissions.

logInWithPublishPermissions

 void logInWithPublishPermissions(Fragment fragment, Collection<String> permissions)
Logs the user in with the requested publish permissions.
Parameters:
fragment - The android.app.Fragment which is starting the login process.
permissions - The requested permissions.

logInWithPublishPermissions

 void logInWithPublishPermissions(Activity activity, Collection<String> permissions)
Logs the user in with the requested publish permissions.
Parameters:
activity - The activity which is starting the login process.
permissions - The requested permissions.

logIn

 void logIn(Fragment fragment, Collection<String> permissions)
Logs the user in with the requested permissions.
Parameters:
fragment - The android.support.v4.app.Fragment which is starting the login process.
permissions - The requested permissions.

logIn

 void logIn(Fragment fragment, Collection<String> permissions, String loggerID)
Logs the user in with the requested permissions.
Parameters:
fragment - The android.support.v4.app.Fragment which is starting the login process.
permissions - The requested permissions.
loggerID - Override the default logger ID for the request

logIn

 void logIn(Fragment fragment, Collection<String> permissions)
Logs the user in with the requested permissions.
Parameters:
fragment - The android.app.Fragment which is starting the login process.
permissions - The requested permissions.

logIn

 void logIn(Fragment fragment, Collection<String> permissions, String loggerID)
Logs the user in with the requested permissions.
Parameters:
fragment - The android.app.Fragment which is starting the login process.
permissions - The requested permissions.
loggerID - Override the default logger ID for the request

logIn

 void logIn(FragmentWrapper fragment, Collection<String> permissions)
Logs the user in with the requested permissions.
Parameters:
fragment - The fragment which is starting the login process.
permissions - The requested permissions.

logIn

 void logIn(FragmentWrapper fragment, Collection<String> permissions, String loggerID)
Logs the user in with the requested permissions.
Parameters:
fragment - The fragment which is starting the login process.
permissions - The requested permissions.
loggerID - Override the default logger ID for the request

logIn

 void logIn(Activity activity, Collection<String> permissions)
Logs the user in with the requested permissions.
Parameters:
activity - The activity which is starting the login process.
permissions - The requested permissions.

logIn

 void logIn(FragmentWrapper fragment, @NonNull() LoginConfiguration loginConfig)
Logs the user in with the requested login configuration.
Parameters:
fragment - The fragment which is starting the login process.
loginConfig - The login config of the request

logIn

 void logIn(Activity activity, @NonNull() LoginConfiguration loginConfig)
Logs the user in with the requested configuration.
Parameters:
activity - The activity which is starting the login process.
loginConfig - The login config of the request

logIn

 void logIn(Activity activity, Collection<String> permissions, String loggerID)
Logs the user in with the requested permissions.
Parameters:
activity - The activity which is starting the login process.
permissions - The requested permissions.
loggerID - Override the default logger ID for the request