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


Java AuthException类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:17,代码来源:CredentialsDialogBuilder.java

示例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");
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:26,代码来源:PlayStoreTask.java

示例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;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:24,代码来源:UserProvidedAccountDialogBuilder.java

示例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);
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:15,代码来源:NativeHttpClientAdapter.java

示例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);
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:11,代码来源:CredentialsDialogBuilder.java

示例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);
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:13,代码来源:PurchaseTask.java

示例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();
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:12,代码来源:PlayStoreTask.java


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