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


Java GooglePlayException类代码示例

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

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

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

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

示例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();

}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:57,代码来源:SearchAdapter.java


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