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


Java Track类代码示例

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


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

示例1: latestVersionCode

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
public int latestVersionCode(PlayStore.ReleaseType releaseType) throws IOException {
    Track track = edits.tracks().get(packageName, id, releaseType.name().toLowerCase(Locale.US)).execute();
    List<Integer> versionCodes = track.getVersionCodes();

    if (versionCodes == null || versionCodes.isEmpty()) {
        return -1;
    }

    // order by desc
    Collections.sort(versionCodes, new Comparator<Integer>() {
        @Override
        public int compare(Integer lhs, Integer rhs) {
            return rhs.compareTo(lhs);
        }
    });
    return versionCodes.get(0);
}
 
开发者ID:sugoi-wada,项目名称:appversionchecker,代码行数:18,代码来源:StoreApi.java

示例2: publishVersion

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
private void publishVersion(Integer currentVersionCode) throws PublishApkException {
	try {
		Track updatedTrack = edits.tracks().update(packageName, appEditId, track.getName(),
				track.createApiTrack().setVersionCodes(Collections.singletonList(currentVersionCode))).execute();
		logger.println(String.format("Version codes %s have been published in Track '%s'",
				Arrays.toString(updatedTrack.getVersionCodes().toArray()), updatedTrack.getTrack()));
	} catch (IOException e) {
		throw new PublishApkException(String.format("Failed to publish Version codes %s in Track '%s'",
				Arrays.toString(Collections.singletonList(currentVersionCode).toArray()), track.getName()), e);
	}
}
 
开发者ID:DavidHamm,项目名称:google-play-publisher,代码行数:12,代码来源:PublishHelper.java

示例3: main

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
                "ApplicationConfig.PACKAGE_NAME cannot be null or empty!");

        // Create the API service.
        AndroidPublisher service = AndroidPublisherHelper.init(
                ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
        final Edits edits = service.edits();

        // Create a new edit to make changes to your listing.
        Insert editRequest = edits
                .insert(ApplicationConfig.PACKAGE_NAME,
                        null /** no content */);
        AppEdit edit = editRequest.execute();
        final String editId = edit.getId();
        log.info(String.format("Created edit with id: %s", editId));

        // Upload new apk to developer console
        final InputStream is = BasicUploadApk.class.getResourceAsStream((ApplicationConfig.APK_FILE_PATH));
        File apkTmpFile = AndroidPublisherHelper.getTempFile(is, "apk");
        URL resource = BasicUploadApk.class.getResource(ApplicationConfig.APK_FILE_PATH);
        //final String apkPath = BasicUploadApk.class
        //       .getResource(ApplicationConfig.APK_FILE_PATH)
        //        .toURI().getPath();
        final AbstractInputStreamContent apkFile =
                new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, apkTmpFile);
        Upload uploadRequest = edits
                .apks()
                .upload(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        apkFile);
        Apk apk = uploadRequest.execute();
        log.info(String.format("Version code %d has been uploaded",
                apk.getVersionCode()));

        // Assign apk to alpha track.
        List<Integer> apkVersionCodes = new ArrayList<>();
        apkVersionCodes.add(apk.getVersionCode());
        Update updateTrackRequest = edits
                .tracks()
                .update(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        TRACK_ALPHA,
                        new Track().setVersionCodes(apkVersionCodes));
        Track updatedTrack = updateTrackRequest.execute();
        log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));

        // Commit changes for edit.
        Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
        AppEdit appEdit = commitRequest.execute();
        log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));

    } catch (IOException | GeneralSecurityException ex) {
        log.error("Excpetion was thrown while uploading apk to alpha track", ex);
    }
}
 
开发者ID:wisobi,项目名称:leanbean,代码行数:58,代码来源:BasicUploadApk.java

示例4: main

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME), "ApplicationConfig.PACKAGE_NAME cannot be null or empty!");

        // Create the API service.
        AndroidPublisher service = AndroidPublisherHelper.init(ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
        final Edits edits = service.edits();

        // Create a new edit to make changes to your listing.
        Insert editRequest = edits.insert(ApplicationConfig.PACKAGE_NAME, null /** no content */);
        AppEdit edit = editRequest.execute();
        final String editId = edit.getId();
        log.info(String.format("Created edit with id: %s", editId));

        // Upload new apk to developer console
        final String apkPath = BasicUploadApk.class
                .getResource(ApplicationConfig.APK_FILE_PATH)
                .toURI().getPath();

        final AbstractInputStreamContent apkFile = new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
        Upload uploadRequest = edits
                .apks()
                .upload(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        apkFile);

        Apk apk = uploadRequest.execute();
        log.info(String.format("Version code %d has been uploaded",
                apk.getVersionCode()));

        // Assign apk to alpha track.
        List<Integer> apkVersionCodes = new ArrayList<Integer>();
        apkVersionCodes.add(apk.getVersionCode());
        Update updateTrackRequest = edits
                .tracks()
                .update(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        TRACK_ALPHA,
                        new Track().setVersionCodes(apkVersionCodes));
        Track updatedTrack = updateTrackRequest.execute();
        log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));

        // Commit changes for edit.
        Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
        AppEdit appEdit = commitRequest.execute();
        log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));

    } catch (IOException | URISyntaxException | GeneralSecurityException ex) {
        log.error("Excpetion was thrown while uploading apk to alpha track", ex);
    }
}
 
开发者ID:rocel,项目名称:playstorepublisher,代码行数:52,代码来源:BasicUploadApk.java

示例5: setTrack

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
public Builder setTrack(de.hamm.googleplaypublisher.Track track) {
	this.track = track;
	return this;
}
 
开发者ID:DavidHamm,项目名称:google-play-publisher,代码行数:5,代码来源:PublishHelper.java

示例6: main

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
                "ApplicationConfig.PACKAGE_NAME cannot be null or empty!");

        // Create the API service.
        AndroidPublisher service = AndroidPublisherHelper.init(
                ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
        final Edits edits = service.edits();

        // Create a new edit to make changes to your listing.
        Insert editRequest = edits
                .insert(ApplicationConfig.PACKAGE_NAME,
                        null /** no content */);
        AppEdit edit = editRequest.execute();
        final String editId = edit.getId();
        log.info(String.format("Created edit with id: %s", editId));

        // Upload new apk to developer console
        final String apkPath = BasicUploadApk.class
                .getResource(ApplicationConfig.APK_FILE_PATH)
                .toURI().getPath();
        final AbstractInputStreamContent apkFile =
                new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
        Upload uploadRequest = edits
                .apks()
                .upload(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        apkFile);
        Apk apk = uploadRequest.execute();
        log.info(String.format("Version code %d has been uploaded",
                apk.getVersionCode()));

        // Assign apk to alpha track.
        List<Integer> apkVersionCodes = new ArrayList<>();
        apkVersionCodes.add(apk.getVersionCode());
        Update updateTrackRequest = edits
                .tracks()
                .update(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        TRACK_ALPHA,
                        new Track().setVersionCodes(apkVersionCodes));
        Track updatedTrack = updateTrackRequest.execute();
        log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));

        // Commit changes for edit.
        Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
        AppEdit appEdit = commitRequest.execute();
        log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));

    } catch (IOException | URISyntaxException | GeneralSecurityException ex) {
        log.error("Excpetion was thrown while uploading apk to alpha track", ex);
    }
}
 
开发者ID:googlesamples,项目名称:android-play-publisher-api,代码行数:55,代码来源:BasicUploadApk.java

示例7: main

import com.google.api.services.androidpublisher.model.Track; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(ApplicationConfig.PACKAGE_NAME),
                "ApplicationConfig.PACKAGE_NAME cannot be null or empty!");

        // Create the API service.
        AndroidPublisher service = AndroidPublisherHelper.init(
                ApplicationConfig.APPLICATION_NAME, ApplicationConfig.SERVICE_ACCOUNT_EMAIL);
        final Edits edits = service.edits();

        // Create a new edit to make changes.
        Insert editRequest = edits
                .insert(ApplicationConfig.PACKAGE_NAME,
                        null /** no content */);
        AppEdit edit = editRequest.execute();
        final String editId = edit.getId();
        log.info(String.format("Created edit with id: %s", editId));

        // Upload new apk to developer console
        final String apkPath = UploadApkWithListing.class
                .getResource(ApplicationConfig.APK_FILE_PATH)
                .toURI().getPath();
        final AbstractInputStreamContent apkFile =
                new FileContent(AndroidPublisherHelper.MIME_TYPE_APK, new File(apkPath));
        Upload uploadRequest = edits
                .apks()
                .upload(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        apkFile);
        Apk apk = uploadRequest.execute();
        log.info(String.format("Version code %d has been uploaded",
                apk.getVersionCode()));

        // Assign apk to beta track.
        List<Integer> apkVersionCodes = new ArrayList<>();
        apkVersionCodes.add(apk.getVersionCode());
        Update updateTrackRequest = edits
                .tracks()
                .update(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        TRACK_BETA,
                        new Track().setVersionCodes(apkVersionCodes));
        Track updatedTrack = updateTrackRequest.execute();
        log.info(String.format("Track %s has been updated.", updatedTrack.getTrack()));

        // Update recent changes field in apk listing.
        final ApkListing newApkListing = new ApkListing();
        newApkListing.setRecentChanges(APK_LISTING_RECENT_CHANGES_TEXT);

        Apklistings.Update
        updateRecentChangesRequest = edits
                .apklistings()
                .update(ApplicationConfig.PACKAGE_NAME,
                        editId,
                        apk.getVersionCode(),
                        Locale.US.toString(),
                        newApkListing);
        updateRecentChangesRequest.execute();
        log.info("Recent changes has been updated.");

        // Commit changes for edit.
        Commit commitRequest = edits.commit(ApplicationConfig.PACKAGE_NAME, editId);
        AppEdit appEdit = commitRequest.execute();
        log.info(String.format("App edit with id %s has been comitted", appEdit.getId()));

    } catch (IOException | URISyntaxException | GeneralSecurityException ex) {
        log.error(
                "Exception was thrown while uploading apk and updating recent changes",
                ex);
    }
}
 
开发者ID:googlesamples,项目名称:android-play-publisher-api,代码行数:72,代码来源:UploadApkWithListing.java


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