当前位置: 首页>>代码示例>>Java>>正文


Java AuthError类代码示例

本文整理汇总了Java中com.amazon.identity.auth.device.AuthError的典型用法代码示例。如果您正苦于以下问题:Java AuthError类的具体用法?Java AuthError怎么用?Java AuthError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AuthError类属于com.amazon.identity.auth.device包,在下文中一共展示了AuthError类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStart

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
@Override
protected void onStart() {
    super.onStart();
    Scope[] scopes = {ProfileScope.profile(), ProfileScope.postalCode()};
    AuthorizationManager.getToken(this, scopes, new Listener<AuthorizeResult, AuthError>() {
        @Override
        public void onSuccess(AuthorizeResult result) {
            if (result.getAccessToken() != null) {
                /* The user is signed in */
                fetchUserProfile();
            } else {
                /* The user is not signed in */
            }
        }

        @Override
        public void onError(AuthError ae) {
            /* The user is not signed in */
        }
    });
}
 
开发者ID:dazcode,项目名称:smart-device-cloud,代码行数:22,代码来源:LoginWithAmazonActivity.java

示例2: fetchUserProfile

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
private void fetchUserProfile() {
    User.fetch(this, new Listener<User, AuthError>() {

        /* fetch completed successfully. */
        @Override
        public void onSuccess(User user) {
            final String name = user.getUserName();
            final String email = user.getUserEmail();
            final String account = user.getUserId();
            final String zipCode = user.getUserPostalCode();


            logged_in_activity_transfer(account);

            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    updateProfileData(name, email, account, zipCode);
                }
            });
        }

        /* There was an error during the attempt to get the profile. */
        @Override
        public void onError(AuthError ae) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    setLoggedOutState();
                    String errorMessage = "Error retrieving profile information.\nPlease log in again";
                    Toast errorToast = Toast.makeText(getApplicationContext(), errorMessage, Toast.LENGTH_LONG);
                    errorToast.setGravity(Gravity.CENTER, 0, 0);
                    errorToast.show();
                }
            });
        }
    });
}
 
开发者ID:dazcode,项目名称:smart-device-cloud,代码行数:39,代码来源:LoginWithAmazonActivity.java

示例3: onError

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
/**
 * There was an error during the attempt to authorize the application.
 * Log the error, and reset the profile text view.
 * @param ae the error that occurred during authorize
 */
@Override
public void onError(AuthError ae) {
    if(BuildConfig.DEBUG) {
        Log.e(TAG, "AuthError during authorization", ae);
        Util.showAuthToast(mContext, "Error during authorization.  Please try again.");
    }
    if(mCallback != null){
        mCallback.onError(ae);
    }
}
 
开发者ID:vaibhavs4424,项目名称:AI-Powered-Intelligent-Banking-Platform,代码行数:16,代码来源:AuthorizationManager.java

示例4: onError

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
@Override
public void onError(AuthError ae) {
	Log.e(LOG_TAG, "AuthError during authorization", ae);
	runOnUiThread(new Runnable() {
		public void run() {
			setResult(Activity.RESULT_CANCELED, null);
			finish();
		}
	});
}
 
开发者ID:jinman,项目名称:snake-game-aws,代码行数:11,代码来源:LoginActivity.java

示例5: onError

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
@Override
public void onError(final AuthError authError) {
    intiLogi();
}
 
开发者ID:raj10071997,项目名称:Alexa-Voice-Service,代码行数:5,代码来源:MainActivity.java

示例6: onCreate

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    requestContext = RequestContext.create(this);
    requestContext.registerListener(new AuthorizeListener() {

        @Override
        public void onSuccess(AuthorizeResult authorizeResult) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {

                    setLoggingInState(true);
                }
            });
            fetchUserProfile();
        }


        @Override
        public void onError(AuthError authError) {
            Log.e(TAG, "AuthError during authorization", authError);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    utilities.showToast("Error during authorization.  Please try again.", getApplicationContext());
                    resetProfileView();
                    setLoggingInState(false);
                }
            });
        }


        @Override
        public void onCancel(AuthCancellation authCancellation) {
            Log.e(TAG, "User cancelled authorization");
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    utilities.showToast("Authorization cancelled.", getApplicationContext());
                    resetProfileView();
                }
            });
        }
    });

    setContentView(R.layout.login_with_amazon);

    initializeUI();
}
 
开发者ID:dazcode,项目名称:smart-device-cloud,代码行数:53,代码来源:LoginWithAmazonActivity.java

示例7: initializeUI

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
private void initializeUI() {


        mLoginButton = findViewById(R.id.login_with_amazon);
        mLoginButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AuthorizationManager.authorize(
                        new AuthorizeRequest.Builder(requestContext)
                                .addScopes(ProfileScope.profile(), ProfileScope.postalCode())
                                .build()
                );
            }
        });

        // Find the button with the logout ID and set up a click handler
        View logoutButton = findViewById(R.id.logout);
        logoutButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                AuthorizationManager.signOut(getApplicationContext(), new Listener<Void, AuthError>() {
                    @Override
                    public void onSuccess(Void response) {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                setLoggedOutState();
                            }
                        });
                    }

                    @Override
                    public void onError(AuthError authError) {
                        Log.e(TAG, "Error clearing authorization state.", authError);
                    }
                });
            }
        });

        String logoutText = getString(R.string.logout);
        mProfileText = (TextView) findViewById(R.id.profile_info);
        mLogoutTextView = (TextView) logoutButton;
        mLogoutTextView.setText(logoutText);
        mLogInProgress = (ProgressBar) findViewById(R.id.log_in_progress);
    }
 
开发者ID:dazcode,项目名称:smart-device-cloud,代码行数:47,代码来源:LoginWithAmazonActivity.java

示例8: onError

import com.amazon.identity.auth.device.AuthError; //导入依赖的package包/类
@Override
public void onError(AuthError ae) {
    Log.e(TAG, "AuthError during authorization", ae);
}
 
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:5,代码来源:ResultActivity.java


注:本文中的com.amazon.identity.auth.device.AuthError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。