This seems to be the main class for initialization and login for AccountKit.
扩展: | Object |
应用安装包: | accountkit |
AccountKit()
public AccountKit()
getLoggingBehaviors()
The console logging behaviors, which can be configured for debugging.
public static LoggingBehaviorCollection getLoggingBehaviors()
isInitialized()
Indicates whether the AccountKit SDK has been initialized.
public static boolean isInitialized()
initialize(Context)
This function initializes the AccountKit SDK, the behavior of AccountKit SDK functions are undetermined if this function is not called. It should be called as early as possible.
public static synchronized void initialize(Context applicationContext)
参数 | 描述 |
---|---|
applicationContext | The application context |
initialize(Context, InitializeCallback)
This function initializes the AccountKit SDK, the behavior of AccountKit SDK functions are undetermined if this function is not called. It should be called as early as possible.
public static void initialize(Context applicationContext, InitializeCallback callback)
参数 | 描述 |
---|---|
applicationContext | The application context |
callback | A callback called when initialize finishes. This will be called even if the sdk is already initialized. |
logInWithEmail(String, String, String)
Starts the email login through sending a confirmation email to the given email
To ensure thread safety please call this from the UI thread
If an account is already logged in. Calling this method will cause that account to be logged out.
public static EmailLoginModel logInWithEmail(String email, String responseType, String initialAuthState)
参数 | 描述 |
---|---|
email | The email to use for login |
responseType | The response type expected |
initialAuthState | The state for the login (optional) |
logInWithPhoneNumber(PhoneNumber, boolean, String, String)
Starts the phone login by sending an SMS to the given phone number
To ensure thread safety please call this from the UI thread
If an account is already logged in. Calling this method will cause that account to be logged out.
public static PhoneLoginModel logInWithPhoneNumber(PhoneNumber phoneNumber, boolean sendWithFacebookNotification, String responseType, String initialAuthState)
参数 | 描述 |
---|---|
phoneNumber | Phone number to authenticate |
sendWithFacebookNotification | If this is sent via facebook notification |
responseType | The response type expected |
initialAuthState | The state for the login (optional) |
logOut()
Initiates logOut using the currently stored Access Token and Account
public static void logOut()
cancelLogin()
Cancels the current login, if one exists
To ensure thread safety please call this from the UI thread
public static void cancelLogin()
cancelLogin(AccountKitCallback)
Cancels the current login, if one exists
To ensure thread safety please call this from the UI thread
public static void cancelLogin(AccountKitCallback callback)
参数 | 描述 |
---|---|
callback | An optional callback when the cancel operation finishes |
continueLoginWithCode(String)
Begins the verification process for the confirmation code
To ensure thread safety please call this from the UI thread
public static void continueLoginWithCode(String code)
参数 | 描述 |
---|---|
code | The sms confirmation code |
getCurrentAccessToken()
Getter for the access token that is current for the application.
public static AccessToken getCurrentAccessToken()
getAccountPreferences()
Returns an instance of account preferences for the current access token.
public static AccountPreferences getAccountPreferences()
getCurrentAccount(AccountKitCallback)
Starts a request to get the current account. Can only be called when there is a current access token available
You should call this at least as often as AccessToken.getTokenRefreshIntervalSeconds to keep your access token from expiring. We recommend every time that the app starts up.
public static void getCurrentAccount(AccountKitCallback callback)
参数 | 描述 |
---|---|
callback | Callback to invoke when the account is retrieved |
getCurrentEmailLogInModel()
public static EmailLoginModel getCurrentEmailLogInModel()
getCurrentPhoneNumberLogInModel()
public static PhoneLoginModel getCurrentPhoneNumberLogInModel()
onActivityCreate(Activity, Bundle)
Called when the calling activity is created
public static void onActivityCreate(Activity activity, Bundle savedInstanceState)
参数 | 描述 |
---|---|
activity | The activity |
savedInstanceState | The saved instance state |
onActivityDestroy(Activity)
Called when the calling activity is destroyed
public static void onActivityDestroy(Activity activity)
参数 | 描述 |
---|---|
activity | The activity |
onActivitySaveInstanceState(Activity, Bundle)
Called on the calling activity saved state
public static void onActivitySaveInstanceState(Activity activity, Bundle outState)
参数 | 描述 |
---|---|
activity | The activity |
outState | The out state |
getApplicationId()
Gets the Facebook application ID for the current app. This should only be called after the SDK has been initialized by calling AccountKit.initialize().
public static String getApplicationId()
getApplicationName()
Gets the Account Kit application Name for the current app. This should only be called after the SDK has been initialized by calling AccountKit.initialize().
public static String getApplicationName()
getClientToken()
Gets the client token for the current app. This should only be called after the SDK has been initialized by calling AccountKit.initialize().
public static String getClientToken()
getAccountKitFacebookAppEventsEnabled()
Gets if Account Kit SDK will log to Facebook App Events or not. This is only true if Facebook SDK is integrated and com.facebook.accountkit.AccountKitFacebookAppEventsEnabled is not specified as true in the manifest. To turn off logging to Facebook App Events, com.facebook.accountkit.LogFacebookAppEvents must be set to false in the manifest.
public static boolean getAccountKitFacebookAppEventsEnabled()
APPLICATION_ID_PROPERTY
public static final String APPLICATION_ID_PROPERTY
APPLICATION_NAME_PROPERTY
public static final String APPLICATION_NAME_PROPERTY
CLIENT_TOKEN_PROPERTY
public static final String CLIENT_TOKEN_PROPERTY
FACEBOOK_APP_EVENTS_ENABLED_PROPERTY
public static final String FACEBOOK_APP_EVENTS_ENABLED_PROPERTY