本文整理汇总了Java中com.amazon.identity.auth.device.api.authorization.AuthCancellation类的典型用法代码示例。如果您正苦于以下问题:Java AuthCancellation类的具体用法?Java AuthCancellation怎么用?Java AuthCancellation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthCancellation类属于com.amazon.identity.auth.device.api.authorization包,在下文中一共展示了AuthCancellation类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCancel
import com.amazon.identity.auth.device.api.authorization.AuthCancellation; //导入依赖的package包/类
@Override
public void onCancel(final AuthCancellation authCancellation) {
Toast.makeText(MainActivity.this, "Your authorization has been cancelled. Please try again.", Toast.LENGTH_SHORT).show();
}
示例2: onCreate
import com.amazon.identity.auth.device.api.authorization.AuthCancellation; //导入依赖的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();
}