A Log In/Log Out button that maintains login state and logs in/out for the app.
This control requires the app ID to be specified in the AndroidManifest.xml.
Extends: | FacebookButtonBase |
Package: | widget |
LoginButton(Context)
Create the LoginButton by inflating from XML
public LoginButton(Context context)
Parameter | Description |
---|---|
context |
LoginButton(Context, AttributeSet)
Create the LoginButton by inflating from XML
public LoginButton(Context context, AttributeSet attrs)
Parameter | Description |
---|---|
context | |
attrs |
LoginButton(Context, AttributeSet, int)
Create the LoginButton by inflating from XML and applying a style.
public LoginButton(Context context, AttributeSet attrs, int defStyle)
Parameter | Description |
---|---|
context | |
attrs | |
defStyle |
setDefaultAudience(DefaultAudience)
Sets the default audience to use when the user logs in. This value is only useful when specifying publish permissions for the native login dialog.
public void setDefaultAudience(DefaultAudience defaultAudience)
Parameter | Description |
---|---|
defaultAudience | The default audience value to use |
getDefaultAudience()
Gets the default audience to use when the user logs in. This value is only useful when specifying publish permissions for the native login dialog.
public DefaultAudience getDefaultAudience()
setReadPermissions(List)
Set the permissions to use when the user logs in. The permissions here can only be read permissions. If any publish permissions are included, the login attempt by the user will fail. The LoginButton can only be associated with either read permissions or publish permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the same instance of LoginButton will result in an exception being thrown unless clearPermissions is called in between.
This method is only meaningful if called before the user logs in. If this is called after login, and the list of permissions passed in is not a subset of the permissions granted during the authorization, it will log an error.
It's important to always pass in a consistent set of permissions to this method, or manage the setting of permissions outside of the LoginButton class altogether (by using the LoginManager explicitly).
public void setReadPermissions(List permissions)
Parameter | Description |
---|---|
permissions | The read permissions to use |
setReadPermissions(String)
Set the permissions to use when the user logs in. The permissions here can only be read permissions. If any publish permissions are included, the login attempt by the user will fail. The LoginButton can only be associated with either read permissions or publish permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the same instance of LoginButton will result in an exception being thrown unless clearPermissions is called in between.
This method is only meaningful if called before the user logs in. If this is called after login, and the list of permissions passed in is not a subset of the permissions granted during the authorization, it will log an error.
It's important to always pass in a consistent set of permissions to this method, or manage the setting of permissions outside of the LoginButton class altogether (by using the LoginManager explicitly).
public void setReadPermissions(String permissions)
Parameter | Description |
---|---|
permissions | The read permissions to use |
setPublishPermissions(List)
Set the permissions to use when the user logs in. The permissions here should only be publish permissions. If any read permissions are included, the login attempt by the user may fail. The LoginButton can only be associated with either read permissions or publish permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the same instance of LoginButton will result in an exception being thrown unless clearPermissions is called in between.
This method is only meaningful if called before the user logs in. If this is called after login, and the list of permissions passed in is not a subset of the permissions granted during the authorization, it will log an error.
It's important to always pass in a consistent set of permissions to this method, or manage the setting of permissions outside of the LoginButton class altogether (by using the LoginManager explicitly).
public void setPublishPermissions(List permissions)
Parameter | Description |
---|---|
permissions | The publish permissions to use |
setPublishPermissions(String)
Set the permissions to use when the user logs in. The permissions here should only be publish permissions. If any read permissions are included, the login attempt by the user may fail. The LoginButton can only be associated with either read permissions or publish permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the same instance of LoginButton will result in an exception being thrown unless clearPermissions is called in between.
This method is only meaningful if called before the user logs in. If this is called after login, and the list of permissions passed in is not a subset of the permissions granted during the authorization, it will log an error.
It's important to always pass in a consistent set of permissions to this method, or manage the setting of permissions outside of the LoginButton class altogether (by using the LoginManager explicitly).
public void setPublishPermissions(String permissions)
Parameter | Description |
---|---|
permissions | The publish permissions to use |
clearPermissions()
Clears the permissions currently associated with this LoginButton.
public void clearPermissions()
setLoginBehavior(LoginBehavior)
Sets the login behavior during authorization. If null is specified, the default (LoginBehavior.NATIVE_WITH_FALLBACK will be used.
public void setLoginBehavior(LoginBehavior loginBehavior)
Parameter | Description |
---|---|
loginBehavior | The LoginBehavior that specifies what behaviors should be attempted during authorization. |
getLoginBehavior()
Gets the login behavior during authorization. If null is returned, the default (LoginBehavior.NATIVE_WITH_FALLBACK will be used.
public LoginBehavior getLoginBehavior()
setToolTipStyle(Style)
Sets the style (background) of the Tool Tip popup. Currently a blue style and a black style are supported. Blue is default
public void setToolTipStyle(Style toolTipStyle)
Parameter | Description |
---|---|
toolTipStyle | The style of the tool tip popup. |
setToolTipMode(ToolTipMode)
Sets the mode of the Tool Tip popup. Currently supported modes are default (normal behavior), always_on (popup remains up until forcibly dismissed), and always_off (popup doesn't show)
public void setToolTipMode(ToolTipMode toolTipMode)
Parameter | Description |
---|---|
toolTipMode | The new mode for the tool tip |
getToolTipMode()
Return the current LoginButton.ToolTipMode for this LoginButton
public ToolTipMode getToolTipMode()
setToolTipDisplayTime(long)
Sets the amount of time (in milliseconds) that the tool tip will be shown to the user. The default is . Any value that is less than or equal to zero will cause the tool tip to be displayed indefinitely.
public void setToolTipDisplayTime(long displayTime)
Parameter | Description |
---|---|
displayTime | The amount of time (in milliseconds) that the tool tip will be displayed to the user |
getToolTipDisplayTime()
Gets the current amount of time (in ms) that the tool tip will be displayed to the user.
public long getToolTipDisplayTime()
dismissToolTip()
Dismisses the Tooltip if it is currently visible
public void dismissToolTip()
registerCallback(CallbackManager, FacebookCallback)
Registers a login callback to the given callback manager.
public void registerCallback(CallbackManager callbackManager, FacebookCallback callback)
Parameter | Description |
---|---|
callbackManager | The callback manager that will encapsulate the callback. |
callback | The login callback that will be called on login completion. |
getNewLoginClickListener()
protected LoginClickListener getNewLoginClickListener()