public class UserSettingsFragment
extends android.support.v4.app.Fragment
SessionState.CREATED_TOKEN_LOADED
state.
Developers can override the use of the active session by calling
the setSession(com.facebook.Session)
method.Constructor and Description |
---|
UserSettingsFragment() |
Modifier and Type | Method and Description |
---|---|
void |
clearPermissions()
Clears the permissions currently associated with this LoginButton.
|
protected void |
closeSession()
Closes the current session.
|
protected void |
closeSessionAndClearTokenInformation()
Closes the current session as well as clearing the token cache.
|
protected String |
getAccessToken()
Gets the access token associated with the current session or null if no
session has been created.
|
SessionDefaultAudience |
getDefaultAudience()
Gets the default audience to use when the session is opened.
|
protected Date |
getExpirationDate()
Gets the date at which the current session will expire or null if no session
has been created.
|
SessionLoginBehavior |
getLoginBehavior()
Gets the login behavior for the session that will be opened.
|
LoginButton.OnErrorListener |
getOnErrorListener()
Returns the current OnErrorListener for this instance of UserSettingsFragment.
|
protected Session |
getSession()
Gets the current Session.
|
protected List<String> |
getSessionPermissions()
Gets the permissions associated with the current session or null if no session
has been created.
|
protected SessionState |
getSessionState()
Gets the current state of the session or null if no session has been created.
|
Session.StatusCallback |
getSessionStatusCallback()
Sets the callback interface that will be called whenever the status of the Session
associated with this LoginButton changes.
|
protected boolean |
isSessionOpen()
Determines whether the current session is open.
|
void |
onActivityCreated(android.os.Bundle savedInstanceState) |
void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
Called when the activity that was launched exits.
|
void |
onCreate(android.os.Bundle savedInstanceState) |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
onDestroy() |
void |
onResume() |
protected void |
onSessionStateChange(SessionState state,
Exception exception)
Called when the session state changes.
|
protected void |
openSession()
Opens a new session.
|
protected void |
openSessionForPublish(String applicationId,
List<String> permissions)
Opens a new session with publish permissions.
|
protected void |
openSessionForPublish(String applicationId,
List<String> permissions,
SessionLoginBehavior behavior,
int activityCode)
Opens a new session with publish permissions.
|
protected void |
openSessionForRead(String applicationId,
List<String> permissions)
Opens a new session with read permissions.
|
protected void |
openSessionForRead(String applicationId,
List<String> permissions,
SessionLoginBehavior behavior,
int activityCode)
Opens a new session with read permissions.
|
void |
setDefaultAudience(SessionDefaultAudience defaultAudience)
Sets the default audience to use when the session is opened.
|
void |
setLoginBehavior(SessionLoginBehavior loginBehavior)
Sets the login behavior for the session that will be opened.
|
void |
setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
Sets an OnErrorListener for this instance of UserSettingsFragment to call into when
certain exceptions occur.
|
void |
setPublishPermissions(List<String> permissions)
Set the permissions to use when the session is opened.
|
void |
setPublishPermissions(String... permissions)
Set the permissions to use when the session is opened.
|
void |
setReadPermissions(List<String> permissions)
Set the permissions to use when the session is opened.
|
void |
setReadPermissions(String... permissions)
Set the permissions to use when the session is opened.
|
void |
setSession(Session newSession)
Set the Session object to use instead of the active Session.
|
void |
setSessionStatusCallback(Session.StatusCallback callback)
Sets the callback interface that will be called whenever the status of the Session
associated with this LoginButton changes.
|
dump, equals, getActivity, getArguments, getFragmentManager, getId, getLayoutInflater, getLoaderManager, getResources, getRetainInstance, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onAttach, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDestroyView, onDetach, onHiddenChanged, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onSaveInstanceState, onStart, onStop, onViewCreated, registerForContextMenu, setArguments, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setRetainInstance, setTargetFragment, setUserVisibleHint, startActivity, startActivityForResult, toString, unregisterForContextMenu
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
onCreateView
in class android.support.v4.app.Fragment
public void onCreate(android.os.Bundle savedInstanceState)
onCreate
in class android.support.v4.app.Fragment
public void onResume()
onResume
in class android.support.v4.app.Fragment
FacebookException
- if errors occur during the loading of user informationpublic void setSession(Session newSession)
newSession
- the Session object to useFacebookException
- if errors occur during the loading of user informationpublic void setDefaultAudience(SessionDefaultAudience defaultAudience)
defaultAudience
- the default audience value to usepublic SessionDefaultAudience getDefaultAudience()
public void setReadPermissions(List<String> permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setPublishPermissions has been calledpublic void setReadPermissions(String... permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setPublishPermissions has been calledpublic void setPublishPermissions(List<String> permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setReadPermissions has been calledIllegalArgumentException
- if permissions is null or emptypublic void setPublishPermissions(String... permissions)
permissions
- the read permissions to useUnsupportedOperationException
- if setReadPermissions has been calledIllegalArgumentException
- if permissions is null or emptypublic void clearPermissions()
public void setLoginBehavior(SessionLoginBehavior loginBehavior)
SessionLoginBehavior.SSO_WITH_FALLBACK
will be used.loginBehavior
- The SessionLoginBehavior
that
specifies what behaviors should be attempted during
authorization.public SessionLoginBehavior getLoginBehavior()
SessionLoginBehavior.SSO_WITH_FALLBACK
will be used.SessionLoginBehavior
that
specifies what behaviors should be attempted during
authorization.public void setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
onErrorListener
- The listener object to setpublic LoginButton.OnErrorListener getOnErrorListener()
public void setSessionStatusCallback(Session.StatusCallback callback)
callback
- the callback interfacepublic Session.StatusCallback getSessionStatusCallback()
protected void onSessionStateChange(SessionState state, Exception exception)
state
- the new stateexception
- any exceptions that occurred during the state changepublic void onActivityCreated(android.os.Bundle savedInstanceState)
onActivityCreated
in class android.support.v4.app.Fragment
public void onActivityResult(int requestCode, int resultCode, android.content.Intent data)
super.onActivityResult(...)
first.onActivityResult
in class android.support.v4.app.Fragment
public void onDestroy()
onDestroy
in class android.support.v4.app.Fragment
protected final Session getSession()
protected final boolean isSessionOpen()
protected final SessionState getSessionState()
protected final String getAccessToken()
protected final Date getExpirationDate()
protected final void closeSession()
protected final void closeSessionAndClearTokenInformation()
protected final List<String> getSessionPermissions()
protected final void openSession()
protected final void openSessionForRead(String applicationId, List<String> permissions)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, can be nullprotected final void openSessionForRead(String applicationId, List<String> permissions, SessionLoginBehavior behavior, int activityCode)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, can be nullbehavior
- the login behavior to use with the sessionactivityCode
- the activity code to use for the SSO activityprotected final void openSessionForPublish(String applicationId, List<String> permissions)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, cannot be nullprotected final void openSessionForPublish(String applicationId, List<String> permissions, SessionLoginBehavior behavior, int activityCode)
applicationId
- the applicationID, can be nullpermissions
- the permissions list, cannot be nullbehavior
- the login behavior to use with the sessionactivityCode
- the activity code to use for the SSO activityCopyright © 2014. All rights reserved.