Android SDK List
Overview
The BambooCloud IDaaS open platform provides Android mobile developers with SDK packages for various login and authentication modules, helping developers quickly integrate login, registration, biometric authentication, and other features.
Latest SDK Packages
| Module Name | SDK Package | Latest Version | Download Link |
|---|---|---|---|
| Common SDK | AuthnCenter_Common_2E-1.5.3.aar | v.1.5.3 | Download |
| Password Login | AuthnCenter_PWLogin_2E-1.5.3.aar | v.1.5.3 | Download |
| SMS Login | AuthnCenter_SMSLogin_2E-1.5.3.aar | v.1.5.3 | Download |
| Biometric Authentication | AuthnCenter_MFA_BioVerify_2E-1.5.3.aar | v.1.5.3 | Download |
| OTP Authentication | AuthnCenter_MFA_OTP-1.5.3.aar | v.1.5.3 | Download |
Changelog
| Version | Update Date | Release Notes |
|---|---|---|
| v1.5.3 | 2022.12.11 | Added biometric authentication, SMS, and password login SDKs. The common package now only contains referenced public libraries and utility classes; business logic and UIs have been split into separate feature packages. |
| v1.4.0 | 2021.10.11 | Fixed known issues and improved SDK stability |
SDK Package Introduction
Common SDK Introduction
The main class for basic configuration and initialization is AuthnCenterAPI. Method overview:
/**
* SMS verification code -- send SMS
*/
public void smsSend(Context context, SendSmsReq req, RequestListener listener)
/**
* Get country/area code. Note: if country/area code support is configured, call this API to obtain the list.
*/
public void getCountryCode(Context context, RequestListener listener)
/**
* Social account binding API
* @param context Context
* @param stateToken Temporary token returned after the current login
* @param otpsmsReq Binding object information
* @param listener Event callback
*/
public void socialBind(Context context, String stateToken, OTPSMSReq otpsmsReq, RequestListener listener)
/**
* Register
* @param context Context
* @param stateToken Temporary token returned after the current login
* @param otpsmsReq Registration object information
* @param listener Event callback
*/
public void register(Context context, String stateToken, OTPSMSReq otpsmsReq, RequestListener listener)
/**
* Parse id_token
* @param context
* @param id_token id_token
* @param listener Callback event
*/
public void getUserInfoFromIdToken(Context context, String id_token, CallbackListener listener)
/**
* Verify id_token
* @param context Context
* @param id_token id_token
* @param listener Callback event
*/
public void verifySign(Context context, String id_token, VerifySignListener listener)
/**
* Refresh token
*
* @param context Context
* @param sessionToken sessionToken returned after login success
* @param listener Callback event
*/
public void refreshToken(Context context, String sessionToken, RequestListener listener)
/**
* Get user ID from ID token
*
* @param idToken idToken returned after login success
*/
public String getUserId(String idToken)The SDK contains the KeyStore operation utility class KeyStoreUtils, which can be called as needed.
Password Login SDK Introduction
The main class for password login initialization is AuthnCenterPWDLogin. Method overview:
/**
* Username/Password login
*
* @param context Context
* @param userName Username
* @param password Password
* @param loginListener Event callback
*/
public void userLoginRequest(Context context, String userName, String password, PWLoginListener loginListener)
/**
* Unified username/password login
* Supports username+password, mobile+password, and email+password.
* @param context Context
* @param userName Username
* @param password Password
* @param loginListener Event callback
*/
public void userLoginAuthRequest(Context context, String userName, String password, PWLoginListener loginListener)
/**
* Mobile number + password
*
* @param context Context
* @param mobile Mobile number
* @param password Password
* @param loginListener Event callback
*/
public void userLoginMobilePwd(Context context, String mobile, String password, PWLoginListener loginListener)
/**
* Email + password
*
* @param context Context
* @param email Email
* @param password Password
* @param loginListener Event callback
*/
public void userLoginEmailPwd(Context context, String email, String password, PWLoginListener loginListener)
/**
* SMS registration
*
* @param context Context
* @param userInfoReq Registration user entity
* @param loginListener Event callback
*/
public void userRegister(Context context, UserInfoReq userInfoReq, PWLoginListener loginListener)
/**
* Retrieve password
*
* @param context Context
* @param findPwdReq Retrieve password entity
* @param loginListener Event callback
*/
public void findPwd(Context context, FindPwdReq findPwdReq, PWLoginListener loginListener)
/**
* Skip password modification
*
* @param context Context
* @param stateToken stateToken
* @param loginListener Event callback
*/
public void skipPwd(Context context, String stateToken, PWLoginListener loginListener)
/**
* Force password modification
*
* @param context Context
* @param pwdReq Password modification entity
* @param stateToken stateToken
* @param loginListener Event callback
*/
public void updatePwd(Context context, UpdatePwdReq pwdReq, String stateToken, PWLoginListener loginListener)PWLoginListener returns different codes when the login API callback is triggered. For different application scenarios, the caller needs to judge and perform relevant business processing. Currently, only the following codes are returned when the password is about to expire or has expired. Refer to the integration demo for details.
| Code Value | Built-in Enum Value | Meaning |
|---|---|---|
| 10006 | SDKCodeType.SDK_PASSWORD_EXPIRED.getCode() | Password has expired |
| 10007 | SDKCodeType.SDK_PASSWORD_WARN.getCode() | Password is about to expire |
SMS Login SDK Introduction
The main class for basic configuration and initialization is AuthnCenterSMSLogin. Method overview:
/**
* Built-in sliding verification
*
* @param mContext Context
*/
BlockPuzzleDialog mBlockPuzzleDialog = new BlockPuzzleDialog(mContext);
mBlockPuzzleDialog.setOnResultsListener(new OnResultsListener() {
@Override
public void onResultsClick(String result) {
LogUtil.getInstance().d("Secondary verification callback result mCaptchaToken:" + result);
// This callback result is the captchaToken parameter for SMS verification
}
@Override
public void onError(String code, String msg) {
ToastUtils.ShowToast(mContext, String.format("Error code: %s Error message: %s", code, msg));
}
});Biometric Authentication SDK Introduction
Built-in API overview of the AuthnCenterMFA package:
/**
* Get binding status
* @param context Context
* @param idToken idToken
* @param listener Callback event
*
*/
public void getStatus(Context context, String idToken, MFAListener listener);
/**
* Bind device
* @param context Context
* @param idToken idToken
* @param map Parameters
* @param listener Callback event
*/
public void bind(Context context, String idToken, Map map, MFAListener listener);
/**
* Unbind device
* @param context Context
* @param idToken idToken
* @param listener Callback event
*/
public void unbind(Context context, String idToken, MFAListener listener);
/**
* Query authentication status
* @param context Context
* @param idToken idToken
* @param listener Callback event
*/
public void getAuthentication(Context context, String idToken, MFAListener listener) ;
/**
* Query authentication status and perform authentication
* @param context Context
* @param idToken idToken
* @param ob Callback event
*/
public void getAuthentication(Context context, String idToken, OnBiometricIdentifyCallback ob);
/**
* Initiate authentication
* @param context Context
* @param idToken idToken
* @param map Parameter map
* @param listener Callback event
*/
public void startAuthentication(Context context, String idToken, Map map, MFAListener listener);
/**
* Initiate authentication including biometric recognition
* @param context Context
* @param idToken idToken
* @param ob Callback event
*/
public void startBiometric(Context context, String idToken, OnBiometricIdentifyCallback ob);
/**
* Bind/unbind/query authentication
* @param context Context
* @param idToken idToken
* @param bt Enum type
* @param ob Callback event
*/
public void startBiometric(Context context, String idToken, BiometricType bt, OnBiometricIdentifyCallback ob);
/**
* Get user ID
* @param idToken IdToken
* @return
*/
public String getUserId(String idToken);OTP Authentication SDK Introduction
AuthnCenterOTP method overview:
/**
* Add TOKEN
*
* @param context Context
* @param text String scanned by the camera
*/
public void addToken(Context context, String text)
/**
* Delete generated token
*
* @param context Context
* @param position Token index
*/
public void delToken(Context context, int position)
/**
* Edit basic information of a generated token
*
* @param context Context
* @param position Index
* @param issuer issuer
* @param label label
* @param image image
*/
public void editToken(Context context, int position, String issuer, String label, Uri image)
/**
* Delete generated token
*
* @param context Context
* @param position Token index
*/
public void delToken(Context context, int position)Token is the core generation class.
TokenCode is the time management class.
TokenPersistence is the code management class.
The SDK has a built-in broadcast constant Constant.ACTION_IMAGE_SAVED. When a new OTP is added, a broadcast is sent. The caller can listen to this broadcast as needed to refresh the list.