对不起这个问题,问题是我提出麻烦从在android上提供aws的认证活动传递给主要活动。如果某些事情是不正确的,它会显得有些混乱,但如果一切正确,应用程序都不会做任何事情:(谢谢!
这是文档AWS - Add User Sign-in to Your Mobile App with Amazon Cognito
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.amazonaws.mobile.auth.ui.AuthUIConfiguration;
import com.amazonaws.mobile.auth.ui.SignInUI;
import com.amazonaws.mobile.client.AWSMobileClient;
import com.amazonaws.mobile.client.AWSStartupHandler;
import com.amazonaws.mobile.client.AWSStartupResult;
public class AuthenticatorActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_authenticator);
AWSMobileClient.getInstance().initialize(this, new AWSStartupHandler() {
@Override
public void onComplete(final AWSStartupResult awsStartupResult) {
AuthUIConfiguration config =
new AuthUIConfiguration.Builder()
.userPools(true) // true? show the Email and Password UI
.logoResId(R.mipmap.ic_solvo) // Change the logo
.backgroundColor(Color.WHITE) // Change the backgroundColor
.isBackgroundColorFullScreen(true) // Full screen backgroundColor the backgroundColor full screenff
.fontFamily("sans-serif-light") // Apply sans-serif-light as the global font
.canCancel(true)
.build();
SignInUI signinUI = (SignInUI) AWSMobileClient.getInstance().getClient(AuthenticatorActivity.this, SignInUI.class);
signinUI.login(AuthenticatorActivity.this, MenuActivity.class).authUIConfiguration(config).execute();
}
}).execute();
}
}
答案 0 :(得分:0)
在底部的onComplete中尝试这个:
if(awsStartupResult.isIdentityIdAvailable()){
startActivity(new Intent(AuthenticatorActivity.this, MenuActivity.class));
}