diff --git a/v2/java/.gitignore b/v2/java/.gitignore
deleted file mode 100644
index e9a67ec..0000000
--- a/v2/java/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.project
-.metadata
-bin/**
-libs/**
-src/resources/*.apk
-src/resources/*.bak
-local.properties
-.classpath
-.settings/
diff --git a/v2/java/README.md b/v2/java/README.md
deleted file mode 100644
index 7a461da..0000000
--- a/v2/java/README.md
+++ /dev/null
@@ -1,69 +0,0 @@
-# Google Play Developer API samples
-
-A collection of Java samples for the Play Developer API.
-
-## Installation
-
-1. Download the Google Play Developer API client library:
-https://developers.google.com/android-publisher/libraries
-
-2. Unzip the client library. The unzipped folder contains the
-google-api-services-androidpublisher-v2.jar client library and a lib/ folder with all required
-dependencies.
-
-3. Import the Java sample code into your favorite IDE and reference all libraries in the /lib folder
-as well as the google-api-services-androidpublisher-v2.jar from the sample project.
-
-## Getting started
-To use the Google Play Developer API you need to create or reuse an existing API project in the
-Google Api console, https://console.developers.google.com/. You can either use the API with a client
-ID for Native Application (Installed Application) or create a Service Account.
-
-### Edit `ApplicationConfig.java` for global sample configuration
-
-1. Specify the name of your application. If the application name is null or blank, the application
-will log a warning. Suggested format is `MyCompany-Application/1.0`.
-
-2. Specify the package name of the app as per developer console.
-
-3. If you want to run any of the upload apk samples, please copy your apk to the `/resources` folder
-and specify the apk file path, i.e. `/resources/your_apk.apk`
-
-### First request using OAuth2: Installed application
-
-1. Edit the `/resources/client_secrets.json` file and add the client ID, client secret and redirect
-uris.
-
-2. Execute any sample class using its `main()` method to begin the auth flow:
-
- A browser window will open and ask you to login. Make sure the account has
- appropriate permissions in the Google Play Developer console.
-
-3. Accept the permissions dialog. The browser should display
-
- `The authentication flow has completed.`
-
- Close the window and go back into your IDE and check the console output.
-
-4. The script will output a list of apks.
-
-5. The tokens will be stored in `.store/android_publisher_api` in your home folder. Remove this file
-to restart the auth flow.
-
-
-### First request using OAuth2: Service accounts
-
-1. Edit `ApplicationConfig.java` and add the service account email
-address.
-
-2. Copy the service account key file, generated in the Google APIs Console into
-the same directory and rename it to `key.p12`.
-
-3. Execute any sample class using its `main()` method in your IDE
-
-4. The script will output a list of apks.
-
-
-> You're all set and ready to run the Play Developer API samples.
-Thank you for being such a great developer on Google Play, your feedback is very important to ensure
-that Google continues to improve the developer experience on Play! Enjoy :-).
diff --git a/v2/java/src/com/google/play/developerapi/samples/AndroidPublisherHelper.java b/v2/java/src/com/google/play/developerapi/samples/AndroidPublisherHelper.java
deleted file mode 100644
index 998de3e..0000000
--- a/v2/java/src/com/google/play/developerapi/samples/AndroidPublisherHelper.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.play.developerapi.samples;
-
-import com.google.api.client.auth.oauth2.Credential;
-import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
-import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
-import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
-import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
-import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.json.JsonFactory;
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-import com.google.api.client.repackaged.com.google.common.base.Strings;
-import com.google.api.client.util.store.DataStoreFactory;
-import com.google.api.client.util.store.FileDataStoreFactory;
-import com.google.api.services.androidpublisher.AndroidPublisher;
-import com.google.api.services.androidpublisher.AndroidPublisherScopes;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.security.GeneralSecurityException;
-import java.util.Collections;
-
-import javax.annotation.Nullable;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Helper class to initialize the publisher APIs client library.
- *
- * Before making any calls to the API through the client library you need to
- * call the {@link AndroidPublisherHelper#init(String)} method. This will run
- * all precondition checks for for client id and secret setup properly in
- * resources/client_secrets.json and authorize this client against the API.
- *
- */
-public class AndroidPublisherHelper {
-
- private static final Log log = LogFactory.getLog(AndroidPublisherHelper.class);
-
- static final String MIME_TYPE_APK = "application/vnd.android.package-archive";
-
- /** Path to the private key file (only used for Service Account auth). */
- private static final String SRC_RESOURCES_KEY_P12 = "src/resources/key.p12";
-
- /**
- * Path to the client secrets file (only used for Installed Application
- * auth).
- */
- private static final String RESOURCES_CLIENT_SECRETS_JSON = "/resources/client_secrets.json";
-
- /**
- * Directory to store user credentials (only for Installed Application
- * auth).
- */
- private static final String DATA_STORE_SYSTEM_PROPERTY = "user.home";
- private static final String DATA_STORE_FILE = ".store/android_publisher_api";
- private static final File DATA_STORE_DIR =
- new File(System.getProperty(DATA_STORE_SYSTEM_PROPERTY), DATA_STORE_FILE);
-
- /** Global instance of the JSON factory. */
- private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
-
- /** Global instance of the HTTP transport. */
- private static HttpTransport HTTP_TRANSPORT;
-
- /** Installed application user ID. */
- private static final String INST_APP_USER_ID = "user";
-
- /**
- * Global instance of the {@link DataStoreFactory}. The best practice is to
- * make it a single globally shared instance across your application.
- */
- private static FileDataStoreFactory dataStoreFactory;
-
- private static Credential authorizeWithServiceAccount(String serviceAccountEmail)
- throws GeneralSecurityException, IOException {
- log.info(String.format("Authorizing using Service Account: %s", serviceAccountEmail));
-
- // Build service account credential.
- GoogleCredential credential = new GoogleCredential.Builder()
- .setTransport(HTTP_TRANSPORT)
- .setJsonFactory(JSON_FACTORY)
- .setServiceAccountId(serviceAccountEmail)
- .setServiceAccountScopes(
- Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
- .setServiceAccountPrivateKeyFromP12File(new File(SRC_RESOURCES_KEY_P12))
- .build();
- return credential;
- }
-
- /**
- * Authorizes the installed application to access user's protected data.
- *
- * @throws IOException
- * @throws GeneralSecurityException
- */
- private static Credential authorizeWithInstalledApplication() throws IOException {
- log.info("Authorizing using installed application");
-
- // load client secrets
- GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
- JSON_FACTORY,
- new InputStreamReader(
- AndroidPublisherHelper.class
- .getResourceAsStream(RESOURCES_CLIENT_SECRETS_JSON)));
- // Ensure file has been filled out.
- checkClientSecretsFile(clientSecrets);
-
- dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
-
- // set up authorization code flow
- GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow
- .Builder(HTTP_TRANSPORT,
- JSON_FACTORY, clientSecrets,
- Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
- .setDataStoreFactory(dataStoreFactory).build();
- // authorize
- return new AuthorizationCodeInstalledApp(
- flow, new LocalServerReceiver()).authorize(INST_APP_USER_ID);
- }
-
- /**
- * Ensure the client secrets file has been filled out.
- *
- * @param clientSecrets the GoogleClientSecrets containing data from the
- * file
- */
- private static void checkClientSecretsFile(GoogleClientSecrets clientSecrets) {
- if (clientSecrets.getDetails().getClientId().startsWith("[[INSERT")
- || clientSecrets.getDetails().getClientSecret().startsWith("[[INSERT")) {
- log.error("Enter Client ID and Secret from "
- + "APIs console into resources/client_secrets.json.");
- System.exit(1);
- }
- }
-
- /**
- * Performs all necessary setup steps for running requests against the API
- * using the Installed Application auth method.
- *
- * @param applicationName the name of the application: com.example.app
- * @return the {@Link AndroidPublisher} service
- */
- protected static AndroidPublisher init(String applicationName) throws Exception {
- return init(applicationName, null);
- }
-
- /**
- * Performs all necessary setup steps for running requests against the API.
- *
- * @param applicationName the name of the application: com.example.app
- * @param serviceAccountEmail the Service Account Email (empty if using
- * installed application)
- * @return the {@Link AndroidPublisher} service
- * @throws GeneralSecurityException
- * @throws IOException
- */
- protected static AndroidPublisher init(String applicationName,
- @Nullable String serviceAccountEmail) throws IOException, GeneralSecurityException {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(applicationName),
- "applicationName cannot be null or empty!");
-
- // Authorization.
- newTrustedTransport();
- Credential credential;
- if (serviceAccountEmail == null || serviceAccountEmail.isEmpty()) {
- credential = authorizeWithInstalledApplication();
- } else {
- credential = authorizeWithServiceAccount(serviceAccountEmail);
- }
-
- // Set up and return API client.
- return new AndroidPublisher.Builder(
- HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(applicationName)
- .build();
- }
-
- private static void newTrustedTransport() throws GeneralSecurityException,
- IOException {
- if (null == HTTP_TRANSPORT) {
- HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
- }
- }
-
-}
diff --git a/v2/java/src/com/google/play/developerapi/samples/ApplicationConfig.java b/v2/java/src/com/google/play/developerapi/samples/ApplicationConfig.java
deleted file mode 100644
index c291bc5..0000000
--- a/v2/java/src/com/google/play/developerapi/samples/ApplicationConfig.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.play.developerapi.samples;
-
-/**
- * Contains global application configuration, which is required by all samples.
- */
-public final class ApplicationConfig {
-
- private ApplicationConfig() {
- // no instance
- }
-
- /**
- * Specify the name of your application. If the application name is
- * {@code null} or blank, the application will log a warning. Suggested
- * format is "MyCompany-Application/1.0".
- */
- static final String APPLICATION_NAME = "";
-
- /**
- * Specify the package name of the app.
- */
- static final String PACKAGE_NAME = "";
-
- /**
- * Authentication.
- *
- * Installed application: Leave this string empty and copy or
- * edit resources/client_secrets.json.
- *
- *
- * Service accounts: Enter the service
- * account email and add your key.p12 file to the resources directory.
- *
- */
- static final String SERVICE_ACCOUNT_EMAIL = "";
-
- /**
- * Specify the apk file path of the apk to upload, i.e. /resources/your_apk.apk
- *
- * This needs to be set for running {@link BasicUploadApk} and {@link UploadApkWithListing}
- * samples.
- *
- */
- public static final String APK_FILE_PATH = "";
-
-}
diff --git a/v2/java/src/com/google/play/developerapi/samples/BasicUploadApk.java b/v2/java/src/com/google/play/developerapi/samples/BasicUploadApk.java
deleted file mode 100644
index a720ec4..0000000
--- a/v2/java/src/com/google/play/developerapi/samples/BasicUploadApk.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.play.developerapi.samples;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.google.api.client.http.AbstractInputStreamContent;
-import com.google.api.client.http.FileContent;
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-import com.google.api.client.repackaged.com.google.common.base.Strings;
-import com.google.api.services.androidpublisher.AndroidPublisher;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Apks.Upload;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Commit;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Insert;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Tracks.Update;
-import com.google.api.services.androidpublisher.model.Apk;
-import com.google.api.services.androidpublisher.model.AppEdit;
-import com.google.api.services.androidpublisher.model.Track;
-
-/**
- * Uploads an apk to the alpha track.
- */
-public class BasicUploadApk {
-
- private static final Log log = LogFactory.getLog(BasicUploadApk.class);
-
- /**
- * Track for uploading the apk, can be 'alpha', beta', 'production' or
- * 'rollout'.
- */
- private static final String TRACK_ALPHA = "alpha";
-
- 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 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);
- }
- }
-}
diff --git a/v2/java/src/com/google/play/developerapi/samples/ListApks.java b/v2/java/src/com/google/play/developerapi/samples/ListApks.java
deleted file mode 100644
index 3bd27cf..0000000
--- a/v2/java/src/com/google/play/developerapi/samples/ListApks.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.play.developerapi.samples;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-import com.google.api.client.repackaged.com.google.common.base.Strings;
-import com.google.api.services.androidpublisher.AndroidPublisher;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Insert;
-import com.google.api.services.androidpublisher.model.Apk;
-import com.google.api.services.androidpublisher.model.ApksListResponse;
-import com.google.api.services.androidpublisher.model.AppEdit;
-
-/**
- * Lists all the apks for a given app.
- */
-public class ListApks {
-
- private static final Log log = LogFactory.getLog(ListApks.class);
-
- 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.
- final 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 appEdit = editRequest.execute();
-
- // Get a list of apks.
- ApksListResponse apksResponse = edits
- .apks()
- .list(ApplicationConfig.PACKAGE_NAME,
- appEdit.getId()).execute();
-
- // Print the apk info.
- for (Apk apk : apksResponse.getApks()) {
- System.out.println(
- String.format("Version: %d - Binary sha1: %s", apk.getVersionCode(),
- apk.getBinary().getSha1()));
- }
- } catch (IOException | GeneralSecurityException ex) {
- log.error("Exception was thrown while updating listing", ex);
- }
- }
-}
diff --git a/v2/java/src/com/google/play/developerapi/samples/UpdateListing.java b/v2/java/src/com/google/play/developerapi/samples/UpdateListing.java
deleted file mode 100644
index 96c396a..0000000
--- a/v2/java/src/com/google/play/developerapi/samples/UpdateListing.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.play.developerapi.samples;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.Locale;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-import com.google.api.client.repackaged.com.google.common.base.Strings;
-import com.google.api.services.androidpublisher.AndroidPublisher;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Commit;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Insert;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Listings.Update;
-import com.google.api.services.androidpublisher.model.AppEdit;
-import com.google.api.services.androidpublisher.model.Listing;
-
-/**
- * Updates US and UK listings. Changes title, short-description, full-description and video for
- * en-US and en-GB locales.
- */
-public class UpdateListing {
-
- private static final Log log = LogFactory.getLog(UpdateListing.class);
-
- private static final String US_LISTING_TITLE = "App Title US";
- private static final String US_LISTING_SHORT_DESCRITPION = "Bacon ipsum";
- private static final String US_LISTING_FULL_DESCRIPTION = "Dessert trunk truck";
-
- private static final String UK_LISTING_TITLE = "App Title UK";
- private static final String UK_LISTING_SHORT_DESCRITPION = "Pancetta ipsum";
- private static final String UK_LISTING_FULL_DESCRIPTION = "Pudding boot lorry";
-
- private static final String LISTINGS_PROMO_VIDEO =
- "https://www.youtube.com/watch?v=ZNSLQlNSPu8";
-
- 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 an edit to update listing for application.
- 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));
-
- // Update listing for US version of the application.
- final Listing newUsListing = new Listing();
- newUsListing.setTitle(US_LISTING_TITLE)
- .setFullDescription(US_LISTING_FULL_DESCRIPTION)
- .setShortDescription(US_LISTING_SHORT_DESCRITPION)
- .setVideo(LISTINGS_PROMO_VIDEO);
-
- Update updateUSListingsRequest = edits
- .listings()
- .update(ApplicationConfig.PACKAGE_NAME,
- editId,
- Locale.US.toString(),
- newUsListing);
- Listing updatedUsListing = updateUSListingsRequest.execute();
- log.info(String.format("Created new US app listing with title: %s",
- updatedUsListing.getTitle()));
-
- // Create and update listing for UK version of the application.
- final Listing newUkListing = new Listing();
- newUkListing.setTitle(UK_LISTING_TITLE)
- .setFullDescription(UK_LISTING_FULL_DESCRIPTION)
- .setShortDescription(UK_LISTING_SHORT_DESCRITPION)
- .setVideo(LISTINGS_PROMO_VIDEO);
-
- Update updateUkListingsRequest = edits
- .listings()
- .update(ApplicationConfig.PACKAGE_NAME,
- editId,
- Locale.UK.toString(),
- newUkListing);
- Listing updatedUkListing = updateUkListingsRequest.execute();
- log.info(String.format("Created new UK app listing with title: %s",
- updatedUkListing.getTitle()));
-
- // 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("Exception was thrown while updating listing", ex);
- }
- }
-}
diff --git a/v2/java/src/com/google/play/developerapi/samples/UploadApkWithListing.java b/v2/java/src/com/google/play/developerapi/samples/UploadApkWithListing.java
deleted file mode 100644
index 1f90584..0000000
--- a/v2/java/src/com/google/play/developerapi/samples/UploadApkWithListing.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.play.developerapi.samples;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.google.api.client.http.AbstractInputStreamContent;
-import com.google.api.client.http.FileContent;
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-import com.google.api.client.repackaged.com.google.common.base.Strings;
-import com.google.api.services.androidpublisher.AndroidPublisher;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Apklistings;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Commit;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Insert;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Apks.Upload;
-import com.google.api.services.androidpublisher.AndroidPublisher.Edits.Tracks.Update;
-import com.google.api.services.androidpublisher.model.Apk;
-import com.google.api.services.androidpublisher.model.ApkListing;
-import com.google.api.services.androidpublisher.model.AppEdit;
-import com.google.api.services.androidpublisher.model.Track;
-
-/**
- * Uploads an apk to the alpha track and updates recent changes description.
- */
-public class UploadApkWithListing {
-
- private static final Log log = LogFactory.getLog(UploadApkWithListing.class);
-
- private static final String APK_LISTING_RECENT_CHANGES_TEXT = "Apk recent changes en-US";
-
- /**
- * Track for uploading the apk, can be 'alpha', beta', 'production' or
- * 'rollout'.
- */
- private static final String TRACK_BETA = "beta";
-
- 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 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);
- }
- }
-
-}
diff --git a/v2/java/src/resources/client_secrets.json b/v2/java/src/resources/client_secrets.json
deleted file mode 100644
index 323ffd0..0000000
--- a/v2/java/src/resources/client_secrets.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "installed": {
- "client_id": "[[INSERT CLIENT ID HERE]]",
- "client_secret": "[[INSERT CLIENT SECRET HERE]]",
- "redirect_uris": [],
- "auth_uri": "https://accounts.google.com/o/oauth2/auth",
- "token_uri": "https://accounts.google.com/o/oauth2/token"
- }
-}
diff --git a/v2/python/README.md b/v2/python/README.md
deleted file mode 100644
index c910625..0000000
--- a/v2/python/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# Google Play Developer Publishing API samples
-
-A collection of command-line samples for the Play Developer Publishing API.
-
-## Installation
-
-1. Download Google APIs Client Library for Python (google-api-python-client):
- https://code.google.com/p/google-api-python-client/
-
- or use pip:
-
- ```bash
- $ pip install google-api-python-client
- ```
-
-2. Make sure you can import the client library:
-
- ```bash
- $ python
- >>> import apiclient
- >>>
- ```
-
-## First request using OAuth2: Installed application
-
-1. Edit the `client_secrets.json` file and add the client ID and client secret.
-
-2. Execute any of the scripts to begin the auth flow:
-
- ```bash
- $ python basic_list_apks.py com.myapp.package
- ```
-
- A browser window will open and ask you to login. Make sure the account has
- enough permissions in the Google Play Developer console.
-
-3. Accept the permissions dialog. The browser should display
-
- `The authentication flow has completed.`
-
- Close the window and go back to the shell.
-
-4. The script will output a list of apks.
-
-5. The tokens will be stored in `androidpublisher.dat`. Remove this file to restart the
- auth flow.
-
-
-## First request using OAuth2: Service accounts
-
-1. Edit `basic_list_apks_service_account.py` and add the service account Email
-address.
-
-2. Copy the service account key file, generated in the Google APIs Console into
-the same directory and rename it to `key.p12`.
-
-3. Execute the script:
-
- ```bash
- $ python basic_list_apks_service_account.py com.myapp.package
- ```
-
-4. The script will output a list of apks.
-
diff --git a/v2/python/basic_list_apks.py b/v2/python/basic_list_apks.py
deleted file mode 100644
index c7c321a..0000000
--- a/v2/python/basic_list_apks.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2014 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Lists all the apks for a given app."""
-
-import argparse
-import sys
-from apiclient import sample_tools
-from oauth2client import client
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument('package_name',
- help='The package name. Example: com.android.sample')
-
-
-def main(argv):
- # Authenticate and construct service.
- service, flags = sample_tools.init(
- argv,
- 'androidpublisher',
- 'v2',
- __doc__,
- __file__,
- parents=[argparser],
- scope='https://www.googleapis.com/auth/androidpublisher')
-
- # Process flags and read their values.
- package_name = flags.package_name
-
- try:
-
- edit_request = service.edits().insert(body={}, packageName=package_name)
- result = edit_request.execute()
- edit_id = result['id']
-
- apks_result = service.edits().apks().list(
- editId=edit_id, packageName=package_name).execute()
-
- for apk in apks_result['apks']:
- print 'versionCode: %s, binary.sha1: %s' % (
- apk['versionCode'], apk['binary']['sha1'])
-
- except client.AccessTokenRefreshError:
- print ('The credentials have been revoked or expired, please re-run the '
- 'application to re-authorize')
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/v2/python/basic_list_apks_service_account.py b/v2/python/basic_list_apks_service_account.py
deleted file mode 100644
index c38ad56..0000000
--- a/v2/python/basic_list_apks_service_account.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2014 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Lists all the apks for a given app."""
-
-import argparse
-
-from apiclient.discovery import build
-import httplib2
-from oauth2client.service_account import ServiceAccountCredentials
-
-
-SERVICE_ACCOUNT_EMAIL = (
- 'ENTER_YOUR_SERVICE_ACCOUNT_EMAIL_HERE@developer.gserviceaccount.com')
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument('package_name',
- help='The package name. Example: com.android.sample')
-
-
-def main():
- # Create an httplib2.Http object to handle our HTTP requests and authorize it
- # with the Credentials. Note that the first parameter, service_account_name,
- # is the Email address created for the Service account. It must be the email
- # address associated with the key that was created.
- # The second parameter is the path to your PKCS 12 key
- credentials = ServiceAccountCredentials.from_p12_keyfile(
- SERVICE_ACCOUNT_EMAIL,
- 'key.p12',
- scopes='https://www.googleapis.com/auth/androidpublisher')
- http = httplib2.Http()
- http = credentials.authorize(http)
-
- service = build('androidpublisher', 'v2', http=http)
-
- # Process flags and read their values.
- flags = argparser.parse_args()
-
- package_name = flags.package_name
-
- try:
-
- edit_request = service.edits().insert(body={}, packageName=package_name)
- result = edit_request.execute()
- edit_id = result['id']
-
- apks_result = service.edits().apks().list(
- editId=edit_id, packageName=package_name).execute()
-
- for apk in apks_result['apks']:
- print 'versionCode: %s, binary.sha1: %s' % (
- apk['versionCode'], apk['binary']['sha1'])
-
- except oauth2client.client.AccessTokenRefreshError:
- print ('The credentials have been revoked or expired, please re-run the '
- 'application to re-authorize')
-
-if __name__ == '__main__':
- main()
diff --git a/v2/python/basic_upload_apks.py b/v2/python/basic_upload_apks.py
deleted file mode 100644
index 925f47a..0000000
--- a/v2/python/basic_upload_apks.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2014 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the 'License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Uploads an apk to the alpha track."""
-
-import argparse
-import sys
-from apiclient import sample_tools
-from oauth2client import client
-
-TRACK = 'alpha' # Can be 'alpha', beta', 'production' or 'rollout'
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument('package_name',
- help='The package name. Example: com.android.sample')
-argparser.add_argument('apk_file',
- nargs='?',
- default='test.apk',
- help='The path to the APK file to upload.')
-
-
-def main(argv):
- # Authenticate and construct service.
- service, flags = sample_tools.init(
- argv,
- 'androidpublisher',
- 'v2',
- __doc__,
- __file__, parents=[argparser],
- scope='https://www.googleapis.com/auth/androidpublisher')
-
- # Process flags and read their values.
- package_name = flags.package_name
- apk_file = flags.apk_file
-
- try:
- edit_request = service.edits().insert(body={}, packageName=package_name)
- result = edit_request.execute()
- edit_id = result['id']
-
- apk_response = service.edits().apks().upload(
- editId=edit_id,
- packageName=package_name,
- media_body=apk_file).execute()
-
- print 'Version code %d has been uploaded' % apk_response['versionCode']
-
- track_response = service.edits().tracks().update(
- editId=edit_id,
- track=TRACK,
- packageName=package_name,
- body={u'versionCodes': [apk_response['versionCode']]}).execute()
-
- print 'Track %s is set for version code(s) %s' % (
- track_response['track'], str(track_response['versionCodes']))
-
- commit_request = service.edits().commit(
- editId=edit_id, packageName=package_name).execute()
-
- print 'Edit "%s" has been committed' % (commit_request['id'])
-
- except client.AccessTokenRefreshError:
- print ('The credentials have been revoked or expired, please re-run the '
- 'application to re-authorize')
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/v2/python/client_secrets.json b/v2/python/client_secrets.json
deleted file mode 100644
index 323ffd0..0000000
--- a/v2/python/client_secrets.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "installed": {
- "client_id": "[[INSERT CLIENT ID HERE]]",
- "client_secret": "[[INSERT CLIENT SECRET HERE]]",
- "redirect_uris": [],
- "auth_uri": "https://accounts.google.com/o/oauth2/auth",
- "token_uri": "https://accounts.google.com/o/oauth2/token"
- }
-}
diff --git a/v2/python/update_listings.py b/v2/python/update_listings.py
deleted file mode 100644
index 7005a8b..0000000
--- a/v2/python/update_listings.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2014 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the 'License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Changes the description, promo text and title of an app in en-US and en-GB.
-"""
-
-import argparse
-import sys
-from apiclient import sample_tools
-from oauth2client import client
-
-TRACK = 'alpha' # Can be 'alpha', beta', 'production' or 'rollout'
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument('package_name',
- help='The package name. Example: com.android.sample')
-
-
-def main(argv):
- # Authenticate and construct service.
- service, flags = sample_tools.init(
- argv,
- 'androidpublisher',
- 'v2',
- __doc__,
- __file__, parents=[argparser],
- scope='https://www.googleapis.com/auth/androidpublisher')
-
- # Process flags and read their values.
- package_name = flags.package_name
-
- try:
- edit_request = service.edits().insert(body={}, packageName=package_name)
- result = edit_request.execute()
- edit_id = result['id']
-
- listing_response_us = service.edits().listings().update(
- editId=edit_id, packageName=package_name, language='en-US',
- body={'fullDescription': 'Dessert trunk truck',
- 'shortDescription': 'Bacon ipsum',
- 'title': 'App Title US'}).execute()
-
- print ('Listing for language %s was updated.'
- % listing_response_us['language'])
-
- listing_response_gb = service.edits().listings().update(
- editId=edit_id, packageName=package_name, language='en-GB',
- body={'fullDescription': 'Pudding boot lorry',
- 'shortDescription': 'Pancetta ipsum',
- 'title': 'App Title UK'}).execute()
-
- print ('Listing for language %s was updated.'
- % listing_response_gb['language'])
-
- commit_request = service.edits().commit(
- editId=edit_id, packageName=package_name).execute()
-
- print 'Edit "%s" has been committed' % (commit_request['id'])
-
- except client.AccessTokenRefreshError:
- print ('The credentials have been revoked or expired, please re-run the '
- 'application to re-authorize')
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/v2/python/upload_apks_rollout.py b/v2/python/upload_apks_rollout.py
deleted file mode 100644
index 31b470a..0000000
--- a/v2/python/upload_apks_rollout.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2014 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the 'License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Uploads apk to rollout track with user fraction."""
-
-import argparse
-import sys
-from apiclient import sample_tools
-from oauth2client import client
-
-TRACK = 'rollout'
-USER_FRACTION = 0.2
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument('package_name',
- help='The package name. Example: com.android.sample')
-argparser.add_argument('apk_file',
- nargs='?',
- default='test.apk',
- help='The path to the APK file to upload.')
-
-
-def main(argv):
- # Authenticate and construct service.
- service, flags = sample_tools.init(
- argv,
- 'androidpublisher',
- 'v2',
- __doc__,
- __file__, parents=[argparser],
- scope='https://www.googleapis.com/auth/androidpublisher')
-
- # Process flags and read their values.
- package_name = flags.package_name
- apk_file = flags.apk_file
-
- try:
- edit_request = service.edits().insert(body={}, packageName=package_name)
- result = edit_request.execute()
- edit_id = result['id']
-
- apk_response = service.edits().apks().upload(
- editId=edit_id, packageName=package_name, media_body=apk_file).execute()
-
- print 'Version code %d has been uploaded' % apk_response['versionCode']
-
- track_response = service.edits().tracks().update(
- editId=edit_id,
- track=TRACK,
- packageName=package_name,
- body={u'track': TRACK,
- u'userFraction': USER_FRACTION,
- u'versionCodes': [apk_response['versionCode']]}).execute()
-
- print 'Track %s is set for version code(s) %s' % (
- track_response['track'], str(track_response['versionCodes']))
-
- commit_request = service.edits().commit(
- editId=edit_id, packageName=package_name).execute()
-
- print 'Edit "%s" has been committed' % (commit_request['id'])
-
- except client.AccessTokenRefreshError:
- print ('The credentials have been revoked or expired, please re-run the '
- 'application to re-authorize')
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/v2/python/upload_apks_with_listing.py b/v2/python/upload_apks_with_listing.py
deleted file mode 100644
index c1f8caa..0000000
--- a/v2/python/upload_apks_with_listing.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2014 Google Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the 'License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Uploads apk to alpha track and updates its listing properties."""
-
-import argparse
-import sys
-from apiclient import sample_tools
-from oauth2client import client
-
-TRACK = 'alpha' # Can be 'alpha', beta', 'production' or 'rollout'
-
-# Declare command-line flags.
-argparser = argparse.ArgumentParser(add_help=False)
-argparser.add_argument('package_name',
- help='The package name. Example: com.android.sample')
-argparser.add_argument('apk_file',
- nargs='?',
- default='test.apk',
- help='The path to the APK file to upload.')
-
-
-def main(argv):
- # Authenticate and construct service.
- service, flags = sample_tools.init(
- argv,
- 'androidpublisher',
- 'v2',
- __doc__,
- __file__, parents=[argparser],
- scope='https://www.googleapis.com/auth/androidpublisher')
-
- # Process flags and read their values.
- package_name = flags.package_name
- apk_file = flags.apk_file
-
- try:
- edit_request = service.edits().insert(body={}, packageName=package_name)
- result = edit_request.execute()
- edit_id = result['id']
-
- apk_response = service.edits().apks().upload(
- editId=edit_id,
- packageName=package_name,
- media_body=apk_file).execute()
-
- print 'Version code %d has been uploaded' % apk_response['versionCode']
-
- track_response = service.edits().tracks().update(
- editId=edit_id,
- track=TRACK,
- packageName=package_name,
- body={u'versionCodes': [apk_response['versionCode']]}).execute()
-
- print 'Track %s is set for version code(s) %s' % (
- track_response['track'], str(track_response['versionCodes']))
-
- listing_response = service.edits().apklistings().update(
- editId=edit_id, packageName=package_name, language='en-US',
- apkVersionCode=apk_response['versionCode'],
- body={'recentChanges': 'Apk recent changes in en-US'}).execute()
-
- print ('Listing for language %s was updated.'
- % listing_response['language'])
-
- commit_request = service.edits().commit(
- editId=edit_id, packageName=package_name).execute()
-
- print 'Edit "%s" has been committed' % (commit_request['id'])
-
- except client.AccessTokenRefreshError:
- print ('The credentials have been revoked or expired, please re-run the '
- 'application to re-authorize')
-
-if __name__ == '__main__':
- main(sys.argv)