本文整理汇总了Java中com.github.yeriomin.playstoreapi.GooglePlayException类的典型用法代码示例。如果您正苦于以下问题:Java GooglePlayException类的具体用法?Java GooglePlayException怎么用?Java GooglePlayException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GooglePlayException类属于com.github.yeriomin.playstoreapi包,在下文中一共展示了GooglePlayException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processException
import com.github.yeriomin.playstoreapi.GooglePlayException; //导入依赖的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: processHttpErrorCode
import com.github.yeriomin.playstoreapi.GooglePlayException; //导入依赖的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);
}
}
示例3: processIOException
import com.github.yeriomin.playstoreapi.GooglePlayException; //导入依赖的package包/类
@Override
protected void processIOException(IOException e) {
super.processIOException(e);
if (e instanceof TokenDispenserException) {
ContextUtil.toast(context, R.string.error_token_dispenser_problem);
} else if (e instanceof GooglePlayException && ((GooglePlayException) e).getCode() == 500) {
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(PreferenceActivity.PREFERENCE_BACKGROUND_UPDATE_INTERVAL, "-1").commit();
ContextUtil.toast(context, R.string.error_invalid_device_definition);
context.startActivity(new Intent(context, PreferenceActivity.class));
}
}
示例4: processIOException
import com.github.yeriomin.playstoreapi.GooglePlayException; //导入依赖的package包/类
@Override
protected void processIOException(IOException e) {
if (null != e && e instanceof GooglePlayException && ((GooglePlayException) e).getCode() == 404) {
ContextUtil.toast(this.context, R.string.details_not_available_on_play_store);
}
}
示例5: onClick
import com.github.yeriomin.playstoreapi.GooglePlayException; //导入依赖的package包/类
@Override
public void onClick(
View view
) {
// Get the InstalledAppView parent
CardView parent = getInstalledAppViewParent(view);
if (parent == null) {
return;
}
final InstalledApp app = mApps.get(mView.getChildLayoutPosition(parent));
final InstalledAppViewHolder holder = (InstalledAppViewHolder) mView.getChildViewHolder(parent);
final int pos = mView.getChildAdapterPosition(parent);
// Check if we are already installing
if (app.getInstallStatus().getStatus() == InstallStatus.STATUS_INSTALLING) {
return;
} else {
changeAppInstallStatusAndNotify(app, InstallStatus.STATUS_INSTALLING, 0, pos);
}
new Thread(new Runnable() {
@Override
public void run() {
try {
AndroidAppDeliveryData data = GooglePlayUtil.getAppDeliveryData(
GooglePlayUtil.getApi(mContext),
app.getPname()
);
long id = DownloadUtil.downloadFile(
mContext,
data.getDownloadUrl(),
data.getDownloadAuthCookie(0).getName() + "=" + data.getDownloadAuthCookie(0).getValue(),
app.getPname() + " " + app.getVersionCode()
);
mAppState.getDownloadInfo().put(
id,
new DownloadInfo(app.getPname(), app.getVersionCode(), app.getVersion())
);
changeAppInstallStatusAndNotify(app, InstallStatus.STATUS_INSTALLING, id, pos);
} catch (GooglePlayException gex) {
SnackBarUtil.make(mActivity, String.valueOf(gex.getMessage()));
mLog.log("SearchAdapter", String.valueOf(gex), LogMessage.SEVERITY_ERROR);
changeAppInstallStatusAndNotify(app, InstallStatus.STATUS_INSTALL, 0, pos);
} catch (Exception e) {
SnackBarUtil.make(mActivity, "Error downloading.");
mLog.log("SearchAdapter", String.valueOf(e), LogMessage.SEVERITY_ERROR);
changeAppInstallStatusAndNotify(app, InstallStatus.STATUS_INSTALL, 0, pos);
}
}
}).start();
}