本文整理汇总了Java中com.github.yeriomin.playstoreapi.AuthException类的典型用法代码示例。如果您正苦于以下问题:Java AuthException类的具体用法?Java AuthException怎么用?Java AuthException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthException类属于com.github.yeriomin.playstoreapi包,在下文中一共展示了AuthException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processException
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
@Override
protected void processException(Throwable e) {
super.processException(e);
if ((e instanceof GooglePlayException && ((GooglePlayException) e).getCode() == 500)
|| (e instanceof AuthException && !TextUtils.isEmpty(((AuthException) e).getTwoFactorUrl()))
) {
return;
}
CredentialsDialogBuilder builder = getDialogBuilder();
if (null != caller) {
builder.setCaller(caller);
}
if (ContextUtil.isAlive(context)) {
builder.show();
}
}
示例2: processAuthException
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
protected void processAuthException(AuthException e) {
AccountTypeDialogBuilder builder = new AccountTypeDialogBuilder(this.context);
builder.setCaller(this);
if (e instanceof CredentialsEmptyException) {
Log.i(getClass().getSimpleName(), "Credentials empty");
if (new FirstLaunchChecker(context).isFirstLogin() && ContextUtil.isAlive(context)) {
Log.i(getClass().getSimpleName(), "First launch, so using built-in account");
builder.logInWithPredefinedAccount();
ContextUtil.toast(context, R.string.first_login_message);
return;
}
} else if (e.getCode() == 401 && PreferenceActivity.getBoolean(context, PlayStoreApiAuthenticator.PREFERENCE_APP_PROVIDED_EMAIL)) {
Log.i(getClass().getSimpleName(), "Token is stale");
builder.refreshToken();
return;
} else {
ContextUtil.toast(this.context, R.string.error_incorrect_password);
new PlayStoreApiAuthenticator(context).logout();
}
if (ContextUtil.isAlive(context)) {
builder.show();
} else {
Log.e(getClass().getSimpleName(), "AuthException happened and the provided context is not ui capable");
}
}
示例3: doInBackground
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
@Override
protected Void doInBackground(String[] params) {
if (params.length < 2
|| params[0] == null
|| params[1] == null
|| TextUtils.isEmpty(params[0])
|| TextUtils.isEmpty(params[1])
) {
exception = new CredentialsEmptyException();
return null;
}
previousEmail = params[0];
try {
new PlayStoreApiAuthenticator(context).login(params[0], params[1]);
addUsedEmail(params[0]);
} catch (Throwable e) {
if (e instanceof AuthException && null != ((AuthException) e).getTwoFactorUrl()) {
addUsedEmail(params[0]);
}
exception = e;
}
return null;
}
示例4: processHttpErrorCode
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
static private void processHttpErrorCode(int code, byte[] content) throws GooglePlayException {
if (code == 401 || code == 403) {
AuthException e = new AuthException("Auth error", code);
Map<String, String> authResponse = GooglePlayAPI.parseResponse(new String(content));
if (authResponse.containsKey("Error") && authResponse.get("Error").equals("NeedsBrowser")) {
e.setTwoFactorUrl(authResponse.get("Url"));
}
throw e;
} else if (code >= 500) {
throw new GooglePlayException("Server error", code);
} else if (code >= 400) {
throw new GooglePlayException("Malformed request", code);
}
}
示例5: processAuthException
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
@Override
protected void processAuthException(AuthException e) {
if (e instanceof CredentialsEmptyException) {
Log.w(getClass().getSimpleName(), "Credentials empty");
} else if (null != e.getTwoFactorUrl()) {
getTwoFactorAuthDialog().show();
} else {
ContextUtil.toast(context, R.string.error_incorrect_password);
}
}
示例6: processAuthException
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
@Override
protected void processAuthException(AuthException e) {
if (e.getCode() == 403) {
if (ContextUtil.isAlive(context)) {
ContextUtil.toast(context, R.string.details_download_not_available);
} else {
Log.w(getClass().getSimpleName(), app.getPackageName() + " not available");
}
} else {
super.processAuthException(e);
}
}
示例7: processException
import com.github.yeriomin.playstoreapi.AuthException; //导入依赖的package包/类
protected void processException(Throwable e) {
Log.d(getClass().getSimpleName(), e.getClass().getName() + " caught during a google api request: " + e.getMessage());
if (e instanceof AuthException) {
processAuthException((AuthException) e);
} else if (e instanceof IOException) {
processIOException((IOException) e);
} else {
Log.e(getClass().getSimpleName(), "Unknown exception " + e.getClass().getName() + " " + e.getMessage());
e.printStackTrace();
}
}