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


Java GooglePlayAPI类代码示例

本文整理汇总了Java中com.github.yeriomin.playstoreapi.GooglePlayAPI的典型用法代码示例。如果您正苦于以下问题:Java GooglePlayAPI类的具体用法?Java GooglePlayAPI怎么用?Java GooglePlayAPI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GooglePlayAPI类属于com.github.yeriomin.playstoreapi包,在下文中一共展示了GooglePlayAPI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getApi

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
GooglePlayAPI getApi() {
    Properties properties = new Properties();
    try {
        properties.load(getClass().getClassLoader().getSystemResourceAsStream("device-gemini.properties"));
    } catch (IOException e) {
        halt(500, "device-gemini.properties not found");
    }

    PropertiesDeviceInfoProvider deviceInfoProvider = new PropertiesDeviceInfoProvider();
    deviceInfoProvider.setProperties(properties);
    deviceInfoProvider.setLocaleString(Locale.ENGLISH.toString());

    GooglePlayAPI api = new GooglePlayAPI();
    api.setClient(new OkHttpClientAdapter());
    api.setDeviceInfoProvider(deviceInfoProvider);
    api.setLocale(Locale.US);
    return api;
}
 
开发者ID:yeriomin,项目名称:token-dispenser,代码行数:19,代码来源:TokenAc2dmResource.java

示例2: purchase

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
protected void purchase(GooglePlayAPI api) {
    try {
        BuyResponse buyResponse = api.purchase(app.getPackageName(), app.getVersionCode(), app.getOfferType());
        if (buyResponse.hasPurchaseStatusResponse()
            && buyResponse.getPurchaseStatusResponse().hasAppDeliveryData()
            && buyResponse.getPurchaseStatusResponse().getAppDeliveryData().hasDownloadUrl()
        ) {
            deliveryData = buyResponse.getPurchaseStatusResponse().getAppDeliveryData();
        }
        if (buyResponse.hasDownloadToken()) {
            downloadToken = buyResponse.getDownloadToken();
        }
    } catch (IOException e) {
        Log.w(getClass().getSimpleName(), "Purchase for " + app.getPackageName() + " failed with " + e.getClass().getName() + ": " + e.getMessage());
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:17,代码来源:DeliveryDataTask.java

示例3: delivery

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
protected void delivery(GooglePlayAPI api) throws IOException {
    DeliveryResponse deliveryResponse = api.delivery(
        app.getPackageName(),
        shouldDownloadDelta() ? app.getInstalledVersionCode() : 0,
        app.getVersionCode(),
        app.getOfferType(),
        GooglePlayAPI.PATCH_FORMAT.GZIPPED_GDIFF,
        downloadToken
    );
    if (deliveryResponse.hasAppDeliveryData()
        && deliveryResponse.getAppDeliveryData().hasDownloadUrl()
    ) {
        deliveryData = deliveryResponse.getAppDeliveryData();
    } else {
        throw new NotPurchasedException();
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:18,代码来源:DeliveryDataTask.java

示例4: getResult

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
@Override
protected List<App> getResult(GooglePlayAPI api, String... packageNames) throws IOException {
    super.getResult(api, packageNames);
    if (!new BlackWhiteListManager(context).isUpdatable(BuildConfig.APPLICATION_ID)) {
        return updatableApps;
    }
    int latestVersionCode = UpdaterFactory.get(context).getLatestVersionCode();
    if (latestVersionCode > BuildConfig.VERSION_CODE) {
        App yalp = InstalledAppsTask.getInstalledApp(context.getPackageManager(), BuildConfig.APPLICATION_ID);
        if (null == yalp) {
            return updatableApps;
        }
        yalp.setVersionCode(latestVersionCode);
        yalp.setVersionName("0." + latestVersionCode);
        updatableApps.add(yalp);
    }
    return updatableApps;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:19,代码来源:ForegroundUpdatableAppsTask.java

示例5: getResult

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
@Override
protected List<App> getResult(GooglePlayAPI api, String... packageNames) throws IOException {
    api.toc();
    Map<String, App> installedApps = getInstalledApps();
    for (App appFromMarket: getAppsFromPlayStore(api, filterBlacklistedApps(installedApps).keySet())) {
        String packageName = appFromMarket.getPackageName();
        if (TextUtils.isEmpty(packageName) || !installedApps.containsKey(packageName)) {
            continue;
        }
        App installedApp = installedApps.get(packageName);
        appFromMarket = addInstalledAppInfo(appFromMarket, installedApp);
        if (installedApp.getVersionCode() < appFromMarket.getVersionCode()) {
            updatableApps.add(appFromMarket);
        }
    }
    return updatableApps;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:18,代码来源:UpdatableAppsTask.java

示例6: getResult

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
@Override
protected App getResult(GooglePlayAPI api, String... arguments) throws IOException {
    DetailsResponse response = api.details(packageName);
    App app = AppBuilder.build(response.getDocV2());
    if (response.hasUserReview()) {
        app.setUserReview(ReviewBuilder.build(response.getUserReview()));
    }
    PackageManager pm = context.getPackageManager();
    try {
        app.getPackageInfo().applicationInfo = pm.getApplicationInfo(packageName, 0);
        app.getPackageInfo().versionCode = pm.getPackageInfo(packageName, 0).versionCode;
        app.setInstalled(true);
    } catch (PackageManager.NameNotFoundException e) {
        // App is not installed
    }
    return app;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:18,代码来源:DetailsTask.java

示例7: getIdTokenPairFromEmailPassword

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
public static Pair<String, String> getIdTokenPairFromEmailPassword(
 Context context,
    String email,
    String password
) throws Exception {

    com.github.yeriomin.playstoreapi.PlayStoreApiBuilder builder = new com.github.yeriomin.playstoreapi.PlayStoreApiBuilder()
        .setHttpClient(new OkHttpClientAdapter())
        .setDeviceInfoProvider(getNativeProvider(context))
        .setLocale(Locale.getDefault())
        .setEmail(email)
        .setPassword(password);

    GooglePlayAPI api = builder.build();
 return new Pair<>(api.getGsfId(), api.getToken());
}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:17,代码来源:GooglePlayUtil.java

示例8: processHttpErrorCode

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的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

示例9: getReviews

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
private List<Review> getReviews(String packageId, int offset, int numberOfResults) throws IOException {
    List<Review> reviews = new ArrayList<>();
    for (com.github.yeriomin.playstoreapi.Review review: new PlayStoreApiAuthenticator(context).getApi().reviews(
        packageId,
        GooglePlayAPI.REVIEW_SORT.HELPFUL,
        offset,
        numberOfResults
    ).getGetResponse().getReviewList()) {
        reviews.add(ReviewBuilder.build(review));
    }
    return reviews;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:13,代码来源:ReviewRetrieverIterator.java

示例10: build

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
private GooglePlayAPI build(LoginInfo loginInfo) throws IOException {
    api = build(loginInfo, RETRIES);
    loginInfo.setGsfId(api.getGsfId());
    loginInfo.setToken(api.getToken());
    save(loginInfo);
    return api;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:8,代码来源:PlayStoreApiAuthenticator.java

示例11: getRestrictionString

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
protected String getRestrictionString() {
    switch (app.getRestriction()) {
        case GooglePlayAPI.AVAILABILITY_NOT_RESTRICTED:
            return null;
        case GooglePlayAPI.AVAILABILITY_RESTRICTED_GEO:
            return context.getString(R.string.availability_restriction_country);
        case GooglePlayAPI.AVAILABILITY_INCOMPATIBLE_DEVICE_APP:
            return context.getString(R.string.availability_restriction_hardware_app);
        default:
            return context.getString(R.string.availability_restriction_generic);
    }
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:13,代码来源:DeliveryDataTask.java

示例12: getResult

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
@Override
protected Void getResult(GooglePlayAPI api, String... arguments) throws IOException {
    Map<String, String> topCategories = buildCategoryMap(api.categories());
    manager.save(CategoryManager.TOP, topCategories);
    for (String categoryId: topCategories.keySet()) {
        manager.save(categoryId, buildCategoryMap(api.categories(categoryId)));
    }
    return null;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:10,代码来源:CategoryTask.java

示例13: initIterator

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
@Override
protected AppListIterator initIterator() throws IOException {
    return new AppListIterator(new CategoryAppsIterator(
        new PlayStoreApiAuthenticator(context).getApi(),
        categoryId,
        GooglePlayAPI.SUBCATEGORY.TOP_FREE
    ));
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:9,代码来源:CategoryAppsTask.java

示例14: getRemoteAppList

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
protected List<App> getRemoteAppList(GooglePlayAPI api, List<String> packageNames) throws IOException {
    List<App> apps = new ArrayList<>();
    for (BulkDetailsEntry details: api.bulkDetails(packageNames).getEntryList()) {
        if (!details.hasDoc()) {
            continue;
        }
        apps.add(AppBuilder.build(details.getDoc()));
    }
    Collections.sort(apps);
    return apps;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:12,代码来源:RemoteAppListTask.java

示例15: getAppsFromPlayStore

import com.github.yeriomin.playstoreapi.GooglePlayAPI; //导入依赖的package包/类
protected List<App> getAppsFromPlayStore(GooglePlayAPI api, Collection<String> packageNames) throws IOException {
    List<App> appsFromPlayStore = new ArrayList<>();
    boolean builtInAccount = PreferenceActivity.getBoolean(context, PlayStoreApiAuthenticator.PREFERENCE_APP_PROVIDED_EMAIL);
    for (App app: getRemoteAppList(api, new ArrayList<>(packageNames))) {
        if (!builtInAccount || app.isFree()) {
            appsFromPlayStore.add(app);
        }
    }
    return appsFromPlayStore;
}
 
开发者ID:yeriomin,项目名称:YalpStore,代码行数:11,代码来源:UpdatableAppsTask.java


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