This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AGConnectAuth.getInstance().signOut(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AGConnectAuthCredential credential = EmailAuthProvider | |
.credentialWithPassword(emailEditText.getText().toString(), passwordEditText.getText().toString()); | |
AGConnectAuth.getInstance().signIn(credential) | |
.addOnSuccessListener(new OnSuccessListener<SignInResult>() { | |
@Override | |
public void onSuccess(SignInResult signInResult) { | |
Toast.makeText(getApplicationContext(), "Successfully Login", Toast.LENGTH_SHORT).show(); | |
startActivity(new Intent(getApplicationContext(), HomeActivity.class)); | |
}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EmailUser emailUser = new EmailUser.Builder() | |
.setEmail(emailEditText.getText().toString()) | |
.setPassword(passwordEditText.getText().toString()) | |
.setVerifyCode(verifyCodeEditText.getText().toString()) | |
.build(); | |
AGConnectAuth.getInstance().createUser(emailUser) | |
.addOnSuccessListener(new OnSuccessListener<SignInResult>() { | |
@Override | |
public void onSuccess(SignInResult signInResult) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task<VerifyCodeResult> task = EmailAuthProvider.requestVerifyCode(emailEditText.getText().toString(), verifyCodeSettings); | |
task.addOnSuccessListener(TaskExecutors.uiThread(), new OnSuccessListener<VerifyCodeResult>() { | |
@Override | |
public void onSuccess(VerifyCodeResult verifyCodeResult) { | |
Toast.makeText(getApplicationContext(), "Please check your e-mail", Toast.LENGTH_SHORT).show(); | |
} | |
}).addOnFailureListener(TaskExecutors.uiThread(), new OnFailureListener() { | |
@Override | |
public void onFailure(Exception e) { | |
Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VerifyCodeSettings verifyCodeSettings = VerifyCodeSettings.newBuilder() | |
.action(VerifyCodeSettings.ACTION_REGISTER_LOGIN) | |
.sendInterval(30) | |
.locale(Locale.getDefault()) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation 'com.huawei.agconnect:agconnect-core:1.4.0.300' | |
implementation 'com.huawei.agconnect:agconnect-auth:1.3.1.300' |