¶ Core Authentication API
¶ Use email registration
Use the email registration, the mailbox is not case sensitive and the only userpool is unique. This interface does not require the user to verify the mailbox, after the user registration, the emailVerified field will be false.
public static void registerByEmail(String email, String password, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
emailemail addresspasswordpasswordcontextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.registerByEmail("test@example.com", "xxxxxx", context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2003Illegal email address2026Registered mailbox
¶ Use email code registration
Use the email registration, the mailbox is not case sensitive and the only userpool is unique. This interface does not require the user to verify the mailbox, after the user registration, the emailVerified field will be false. You need to use it first sendEmail sends a SMS verification code.
public static void registerByEmailCode(String email, String code, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
emailemail addresscodeemail verification codecontextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.registerByEmailCode("test@example.com", "1234", context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2003Illegal email address2026Registered mailbox
¶ Register using username
Use the username to register, the username is case sensitive and the only user pool.
public static void registerByUserName(String username, String password, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
usernameusernamepasswordpasswordcontextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.registerByUserName("username", "strong", context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2026The user name already exists
¶ Use mobile phone number registration
Use your mobile phone number to register, you can set the initial password of the account at the same time. You can pass sendSmsCode method sends SMS verification code.
public static void registerByPhoneCode(String phoneCountryCode, String phone, String code, String password, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
phoneCountryCodeTelephone country code, If null, the default value is+86phoneThe phone numbercodeSMS verification codepasswordinitial password, it can benullcontextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.registerByPhoneCode("+86", "188xxxx8888", "1234", "xxxxxx", context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2001SMS verification code error2026Cell phone number registered
¶ Custom field registration
You can directly log in to an account registered with a user-defined field using the account password.
public static void registerByExtendField(String fieldName, String account, String password, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
fieldNamecustom field name
accountaccountpasswordinitial password, it can benullcontextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.registerByExtendField("extendId", "188xxxx8888", "xxxxxx", context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2026The user name already exists
¶ Use the username to login
public static void loginByAccount(String account, String password, boolean autoRegister, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
accountThe phone number / email address / usernamepasswordPasswordautoRegisterWhether it is automatically registered. If the user does not exist, an account is automatically created according to the login book.contextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.loginByAccount("account", "xxxxxx", false, context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2333The account or password is incorrect
¶ Use the email code to login
Use the email verification code to log in. You need to use it first sendEmail sends a email verification code.
public static void loginByEmailCode(String email, String code, boolean autoRegister, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
emailemail addresscodeemail verification codeautoRegisterWhether it is automatically registered. If the user does not exist, an account is automatically created according to the login book.contextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.loginByEmailCode("test@example.com", "xxxxxx", false, context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2001email verification code error
¶ Use the mobile phone number verification code to login
Use the mobile phone number verification code to log in. You need to use it first sendSmsCode sends a SMS verification code.
public static void loginByPhoneCode(String phoneCountryCode, String phone, String code, boolean autoRegister, String context, @NotNull AuthCallback<UserInfo> callback)
Parameter
phoneCountryCodeTelephone country code, If null, the default value is +86phoneThe phone numbercodeSMS verification codeautoRegisterWhether it is automatically registered. If the user does not exist, an account is automatically created according to the login book.contextRequest context, set herecontextyou can get pipeline context (opens new window). This parameter can be passed tonullif not required.
Example
JSONObject context = new JSONObject();
context.put("userId", "userId");
AuthClient.loginByPhoneCode("+86", "188xxxx8888", "1234", false, context.toString(), (code, message, userInfo)->{
if (code == 200) {
// userInfo
}
});
Error Code
2001SMS verification code error
¶ Get the user information of current login
Get the user information of the current login user, you need that is currently logged in to get it.
public static void getCurrentUser(@NotNull AuthCallback<UserInfo> callback)
Example
AuthClient.getCurrentUser((code, message, userInfo) -> {
if (code == 200) {
// userInfo
}
});
Error Code
2020Not logged in
¶ Sign out
Log out. Clear token and user information for both memory and local persistence. Authing.getcurrentuser () returns empty after logging out.
public static void logout(@NotNull AuthCallback<?> callback)
Example
// AuthFlow.start(this) will go to login page
AuthClient.logout((code, message, data)-> AuthFlow.start(this));
Error Code
1010001If the user id token is invalid or expired
¶ Send verification code
Sends an SMS verification code to the specified mobile phone.
public static void sendSms(String phoneCountryCode, String phone, @NotNull AuthCallback<?> callback)
Parameter
phoneCountryCodeTelephone country code, If null, the default value is +86phoneThe phone number
Example
AuthClient.sendSms("+86", "188xxxx8888", (code, message, data)->{});
Error Code
500The mobile phone number format is invalid
¶ Send email
Sends an email to the specified mailbox.
public static void sendEmail(String emailAddress, String scene, @NotNull AuthCallback<JSONObject> callback)
Parameter
emailemail addresssceneSend a scene, optional value is :RESET_PASSWORD: Send a reset password message, including the verification code;VERIFY_EMAIL: Send a message to verify the mailbox;CHANGE_EMAIL: Send a modified mailbox message, including the verification code;MFA_VERIFY: Send MFA verification email;- VERIFY_CODE: Send verification code.
Example
AuthClient.sendEmail("test@example.com", "RESET_PASSWORD", (code, message, data)->{
if (code == 200) {
// success
}
});
Error Code
1020017Invalid email address
¶ Get custom data
Get all custom data for the user. You need to be in the user pool Define user-defined data meta information (opens new window). User-defined data is added to the passed userInfo object. A login is required to invoke this interface.
public static void getCustomUserData(UserInfo userInfo, @NotNull AuthCallback<UserInfo> callback)
Parameter
userInfo
Example
AuthClient.getCustomUserData(Authing.getCurrentUser(), (code, message, data)->{
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Set custom data
Set the user's custom field. You need to be in the userpoolDefine user-defined data meta information (opens new window), and the type of incoming value must match the defined type. A login is required to invoke this interface.
public static void setCustomUserData(JSONObject customData, @NotNull AuthCallback<JSONObject> callback)
Parameter
customDataJSONObject in the form of key-value
Example
JSONObject object = new JSONObject();
object.put("your_custom_data_key", "your_custom_data_value");
AuthClient.setCustomUserData(object, (code, message, res) -> {
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Update user profile picture
Update the user profile picture by selecting an image from the system. A login is required to invoke this interface.
public static void uploadAvatar(InputStream in, @NotNull AuthCallback<UserInfo> callback)
Parameter
inImage input stream. You are advised to use the default image picker
Example
Start the system default image selector
Intent i = new Intent();
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
i.setAction(Intent.ACTION_GET_CONTENT);
((Activity) getContext()).startActivityForResult(Intent.createChooser(i, "Select Picture"), 1000);
Get the image input stream with the following callback and call the update avatar interface
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == 1000) {
Uri selectedImageUri = data.getData();
InputStream in;
try {
in = getContentResolver().openInputStream(selectedImageUri);
AuthClient.uploadAvatar(in, (code, message, userInfo) -> runOnUiThread(()-> {
// handle result
}));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
Error Code
2020Not logged in
¶ Reset password via SMS verification code
Reset your password by SMS verification code, you can send SMS verification code by [sendSmsCode](#Send verification code) method.
public static void resetPasswordByPhoneCode(String phone, String code, String newPassword, @NotNull AuthCallback<JSONObject> callback)
Parameter
phoneThe phone numbercodeSMS Verification codepasswordNew password
Example
AuthClient.resetPasswordByPhoneCode("188xxxx8888", "1234", "xxxxxx", (code, message, data)->{
if (code == 200) {
}
});
Error Code
2004User does not exist
¶ Reset password via mail verification code
eset password by email verification code, you need to call [sendEmail](#Send email) interface to send a reset password message (the scene value RESET_PASSWORD).
public static void resetPasswordByEmailCode(String emailAddress, String code, String newPassword, @NotNull AuthCallback<JSONObject> callback)
Parameter
emailEmail addresscodeVerification codepasswordNew password
Example
AuthClient.resetPasswordByEmailCode("test@example.com", "1234", "xxxxxx", (code, message, data)->{
if (code == 200) {
}
});
Error Code
2004User does not exist
¶ Modify user profile
Modify user information, this interface cannot be used to modify the mobile phone number, email, password.
public static void updateProfile(JSONObject object, @NotNull AuthCallback<UserInfo> callback)
Parameter
objectModified user profile
Fields of data can be updated through this interface:
usernamenicknamecompanyphotobrowserdevicenamegivenNamefamilyNamemiddleNameprofilepreferredUsernamewebsitegenderbirthdatezoneinfolocaleaddressstreetAddresslocalityregionpostalCodecityprovincecountry
Example
JSONObject body = new JSONObject();
body.put("username", "elonmusk");
body.put("nickname", "Ironman");
AuthClient.updateProfile(body, (code, message, userInfo)->{
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Update user password
Update the user password. If the user does not set a password, such as SMS verification code, social login, etc., oldPassword is left blank.
public static void updatePassword(String newPassword, String oldPassword, @NotNull AuthCallback<JSONObject> callback)
Parameter
newPasswordNew passwordoldPasswordOld password, if the user does not set a password, you can not fill
Example
AuthClient.updatePassword("newStrong", "oldStrong", (code, message, data) -> {
if (code == 200) {
}
});
Error Code
2020Not logged in1320011The old password is incorrect
¶ Update user mobile phone number
Update the user mobile phone number. you can send SMS verification code by [sendSmsCode](#Send verification code) method.
public static void updatePhone(String phoneCountryCode, String phone, String code,
String oldPhoneCountryCode, String oldPhone, String oldCode,
@NotNull AuthCallback<UserInfo> callback)
Parameter
phoneCountryCodeNew mobile phone country code,It must start with a +, for example, +86 in mainland ChinaphoneNew mobile phone numbercodeNew mobile phone number verification codeoldPhoneCountryCodeOld mobile phone country code,It must start with a +, for example, +86 in mainland ChinaoldPhoneOld mobile phone numberoldCodeOld mobile phone number verification code
Example
AuthClient.updatePhone("+86", "188xxxx8888", "1234", "+86", "188xxxx1111", "1234",(code, message, data)->{
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Binding mobile phone number
Bind the mobile phone number of the current login user. you can send SMS verification code by [sendSmsCode](#Send verification code) method.
public static void bindPhone(String phoneCountryCode, String phone, String code, @NotNull AuthCallback<UserInfo> callback)
Parameter
phoneCountryCodeNew mobile phone country code,It must start with a +, for example, +86 in mainland ChinaphoneThie phone numbercodeSMS Verification code
Example
AuthClient.bindPhone("+86", "188xxxx8888", "1234", (code, message, data)->{
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Solution to the mobile number
The user unbinds the mobile phone number. If the user does not bind other login methods (such as email or social login account), the mobile phone number cannot be unbound and an error message is displayed.
public static void unbindPhone(@NotNull AuthCallback<UserInfo> callback)
Example
AuthClient.unbindPhone((code, message, data)-> {
if (code == 200) {
}
});
Error Code
2020Not logged in1320005The current user is not bound to any other login mode
¶ Binding mailbox
The mailbox is bound to the current login user. call [Send emai](#Send email) to get the verification code.
public static void bindEmail(String email, String code, @NotNull AuthCallback<UserInfo> callback)
Parameter
emailEmail addresscodeEmail verification code
Example
AuthClient.bindEmail("test@example.com", "1234", (code, message, data)->{
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Menned mailbox
The user solves the mobile phone number. If the user does not bind other login mode (mobile phone number, social login account), it will not be able to decompose the mailbox, will prompt the error.
public static void unbindEmail(@NotNull AuthCallback<UserInfo> callback)
Example
AuthClient.unbindEmail((code, message, data)-> {
if (code == 200) {
}
});
Error Code
2020Not logged in1320005The current user is not bound to a mailbox
¶ Calculate password security level
Calculate the password security level :
EWeak: LowEMedium: MiddleEStrong: High
public static PasswordStrength computePasswordSecurityLevel(String password)
Example
PasswordStrength result = AuthClient.computePasswordSecurityLevel("123"); // EWeak
¶ Get user account security level
Get user account security level.
public static void getSecurityLevel(@NotNull AuthCallback<JSONObject> callback)
Example
AuthClient.getSecurityLevel((code, message, data)-> {
if (code == 200) {
}
});
Callback data data structure
{
"score": 60,
"email": false,
"phone": false,
"password": true,
"passwordSecurityLevel": 1,
"mfa": false
}
Error Code
2020Not logged in
¶ Refreshes the Token of the current user
public static void updateIdToken(@NotNull AuthCallback<UserInfo> callback)
Example
AuthClient.updateIdToken((code, message, userInfo) ->{
if (code == 200) {
}
});
Error Code
2020Not logged in
¶ Get applications that current users can access
Get the application that the current user can access. Note that the returned result data structure is List<Application>.
public static void listApplications(int page, int limit, @NotNull AuthCallback<List<Application>> callback)
Parameter
pagePage serial number, default is1.limitThe number of times returned per page, the default is10.
Example
AuthClient.listApplications((code, message, applications) ->{
if (code == 200) {
}
});
Callback data data structure
{
"code": 200,
"message": "获取可访问的应用列表成功",
"data": {
"list": [
{
"id": "61ae0c9807451d6f30226bd4",
"name": "lance-test",
"logo": "https://files.authing.co/authing-console/default-app-logo.png",
"domain": "lance-test",
"description": null,
"createdAt": "2021-12-06T13:14:01.123Z",
"updatedAt": "2022-01-20T10:51:02.806Z",
"protocol": "oidc",
"isIntegrate": false,
"appType": "INDIVIDUAL",
"template": null
}
],
"totalCount": 1
}
}
Error Code
2020Not logged in
¶ Get list of data data in users
Obtain the organization of the user. Because the user can be in multiple independent organization trees, this interface returns a two-digit array. Note that the returned result data structure is List<Organization[]>.
public static void listOrgs(@NotNull AuthCallback<List<Organization[]>> callback)
Example
AuthClient.listOrgs((code, message, organizations)->{
if (code == 200) {
}
});
Callback data data structure
{
"code": 200,
"message": "获取用户组织机构列表成功",
"data": [
[
{
"type": "org",
"id": "6108e6fd64c0de1975728fe9",
"createdAt": "2021-08-03T06:49:33.907Z",
"updatedAt": "2021-08-03T06:49:33.920Z",
"userPoolId": "60caaf41da89f1954875cee1",
"rootNodeId": "6108e6fd552ad0a95a2ac771",
"logo": null,
"tenantId": null
},
{
"type": "node",
"id": "6108e6fd552ad0a95a2ac771",
"createdAt": "2021-08-03T06:49:33.911Z",
"updatedAt": "2021-08-03T06:49:33.911Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "6108e6fd64c0de1975728fe9",
"name": "HR",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
},
{
"type": "node",
"id": "6108e710d2120ac0eb9af7d7",
"createdAt": "2021-08-03T06:49:52.670Z",
"updatedAt": "2021-08-03T06:49:52.670Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "6108e6fd64c0de1975728fe9",
"name": "DevHR",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
},
{
"type": "node",
"id": "6108e7763c30fecb43f9b6a4",
"createdAt": "2021-08-03T06:51:34.505Z",
"updatedAt": "2021-08-03T06:51:34.505Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "6108e6fd64c0de1975728fe9",
"name": "JavaDevHR",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
}
],
[
{
"type": "org",
"id": "61e9408778066eaab14965de",
"createdAt": "2022-01-20T10:59:19.035Z",
"updatedAt": "2022-01-20T10:59:19.051Z",
"userPoolId": "60caaf41da89f1954875cee1",
"rootNodeId": "61e94087cf40643c9637e03c",
"logo": null,
"tenantId": null
},
{
"type": "node",
"id": "61e94087cf40643c9637e03c",
"createdAt": "2022-01-20T10:59:19.042Z",
"updatedAt": "2022-01-20T10:59:19.042Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "61e9408778066eaab14965de",
"name": "RD",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
},
{
"type": "node",
"id": "61e94092ac13f7afd26d05b7",
"createdAt": "2022-01-20T10:59:30.405Z",
"updatedAt": "2022-01-20T10:59:30.405Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "61e9408778066eaab14965de",
"name": "Mobile",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
}
],
[
{
"type": "org",
"id": "6108e6fd64c0de1975728fe9",
"createdAt": "2021-08-03T06:49:33.907Z",
"updatedAt": "2021-08-03T06:49:33.920Z",
"userPoolId": "60caaf41da89f1954875cee1",
"rootNodeId": "6108e6fd552ad0a95a2ac771",
"logo": null,
"tenantId": null
},
{
"type": "node",
"id": "6108e6fd552ad0a95a2ac771",
"createdAt": "2021-08-03T06:49:33.911Z",
"updatedAt": "2021-08-03T06:49:33.911Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "6108e6fd64c0de1975728fe9",
"name": "HR",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
},
{
"type": "node",
"id": "6108e710d2120ac0eb9af7d7",
"createdAt": "2021-08-03T06:49:52.670Z",
"updatedAt": "2021-08-03T06:49:52.670Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "6108e6fd64c0de1975728fe9",
"name": "DevHR",
"nameI18n": null,
"description": null,
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
},
{
"type": "node",
"id": "62039e6b017b8cf3b5bb6ec4",
"createdAt": "2022-02-09T10:58:51.422Z",
"updatedAt": "2022-02-09T10:59:16.718Z",
"userPoolId": "60caaf41da89f1954875cee1",
"orgId": "6108e6fd64c0de1975728fe9",
"name": "SwiftDevHR",
"nameI18n": null,
"description": "",
"descriptionI18n": null,
"order": null,
"code": null,
"leaderUserId": null
}
]
]
}
Error Code
2020Not logged in
¶ Get the list of roles owned by users
Get the list of roles owned by users. Note that the returned result data structure is List<Role>.
public static void listRoles(String namespace, @NotNull AuthCallback<List<Role>> callback)
Parameter
namespacePermission group ID, used to filter role data. If empty, all roles of the user are returned
Example
AuthClient.listRoles(null, (code, message, roles) ->{
if (code == 200) {
}
});
Callback data data structure
{
"code": 200,
"message": "获取成功",
"data": [
{
"id": "61ada935ce061fe3476f0f09",
"createdAt": "2021-12-06T06:09:57.523Z",
"updatedAt": "2021-12-06T06:09:57.523Z",
"userPoolId": "60caaf41da89f1954875cee1",
"code": "admin",
"description": null,
"parentCode": null,
"isSystem": false,
"namespaceId": 36141,
"namespace": "60caaf414f9323f25f64b2f4"
}
]
}
Error Code
2020Not logged in
¶ Get all the list of users authorized to be authorized
Gets all resources authorized by users, and users are authorized to include resources that are inherited from roles, packets, and organizational institutions.
public static void listAuthorizedResources(String namespace, String resourceType, @NotNull AuthCallback<List<Resource>> callback)
Parameter
namespacePermission group ID.resourceTypeResource type. Can be the following types of DATA, API, MENU, UI, BUTTON. If null, all resource type data is returned.
Example
AuthClient.listAuthorizedResources("default", (code, message, resources)->{
if (code == 200) {
}
});
Callback data data structure
{
"totalCount": 1,
"list": [
{
"code": "ci:*",
"type": "DATA",
"actions": [
"*"
],
"apiIdentifier": null
}
]
}
Error Code
2020Not logged in
¶ Reset password through the first login Token
Reset password through the first login Token. You need to set Force User to change password at first login when creating a user.
public static void resetPasswordByFirstTimeLoginToken(String token, String newPassword, @NotNull AuthCallback<JSONObject> callback)
Parameter
tokenFirst login TokenpasswordReset password
Example
AuthClient.resetPasswordByFirstTimeLoginToken(token, password, (code, message, data)->{
if (code == 200) {
}
});
¶ Delete the account
Users can delete their current login accounts.
This operation cannot be reversed. Therefore, you must prompt the user.
public static void deleteAccount(AuthCallback<JSONObject> callback)
Example
private void deleteAccount() {
new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.authing_delete_account).setMessage(R.string.authing_delete_account_tip)
.setPositiveButton(android.R.string.yes, (dialog, which) -> AuthClient.deleteAccount((code, message, data) -> {
if (code == 200) {
AuthFlow.start(UserProfileActivity.this);
} else {
runOnUiThread(()->Toast.makeText(UserProfileActivity.this, message, Toast.LENGTH_LONG).show());
}
}))
.setNegativeButton(android.R.string.no, null).show();
}