- Google Play Developer API
- In this document
- See also
- Publishing API
- Subscriptions and In-App Purchases API
- Using the API
- Staged Edits
- Using the API Efficiently
- Quota
- Google Play Developer API
- Subscriptions and In-App Purchases
- Publishing API
- Getting Started
- Other APIs
- Google Play In-App Review API: пошаговое руководство по внедрению
- Руководство
- Добавление зависимостей
- Реализация
- Тестирование
- Internal app sharing
- Итоги
Google Play Developer API
In this document
See also
- Developer API reference
- Google Help Center overview of the Google Play Developer API
The Google Play Developer API is a REST-based web service that allows you to perform publishing and app-management tasks. You can use this API to integrate your publishing operations with your release-management process.
Not all developers will need to use these APIs—in most cases you will continue to manage your apps directly using the Google Play Developer Console. However, if you have a large number of APKs to manage, or have to track user purchases and subscriptions, you may find this API very useful.
Using the Google Play Developer API, you can automate a variety of app-management tasks, including:
- Uploading and releasing new versions of your app
- Editing your app Google Play Store listings, including localized text and graphics
- Managing your in-app product catalog, your products purchase status and your app subscriptions
The Google Play Developer API lets you focus on designing and developing your app, while spending less time and effort managing your releases, even as you grow to new markets.
The Google Play Developer API includes two components:
- The Publishing API lets you upload and publish apps, and perform other publishing-related tasks.
- The Subscriptions and In-App Purchases API lets you manage in-app purchases and subscriptions. (This was previously known as the «Purchase Status API».)
Publishing API
The Google Play Developer Publishing API allows you to automate frequent tasks having to do with app distribution. This provides functions similar to those available to a developer through the Google Play Developer Console, such as:
- Uploading new versions of an app
- Releasing apps, by assigning APKs to various Tracks (alpha, beta, staged rollout, or production)
- Creating and modifying Google Play Store listings, including localized text and graphics and multi-device screenshots
Those tasks are performed using the edits functionality, which takes a transactional approach to making changes — you bundle several changes into a single draft edit, then commit the changes all at once. (None of the changes take effect until the edit is committed.)
Note: Not all developers will need to use this API. All the functionality provided by the API is also available through the Google Play Developer Console. However, this API lets you integrate your app and listing update process with your existing tools, which will be very useful for some developers. In particular, if you have a large number of APKs to manage, or localized listings in many different locales, you may find this API invaluable.
Subscriptions and In-App Purchases API
The API allows you to manage your app’s catalog of in-app products and subscriptions. In addition, with the Subscriptions and In-App Purchases API you can quickly retrieve the details of any purchase using a standard GET request. In the request you supply information about the purchase — app package name, purchase or subscription ID, and the purchase token. The server responds with a JSON object describing the associated purchase details, order status, developer payload, and other information.
You can use the Purchase Status API in several ways, such as for reporting and reconciliation of individual orders and for verifying purchases and subscription expirations. You can also use the API to learn about cancelled orders and confirm whether in-app products have been consumed, including whether they were consumed before being cancelled.
Note: The Subscriptions and In-App Purchases API does not use the new, transactional «edits» functionality used by the Publishing API. Methods for the Inappproducts, Purchases.products, and Purchases.subscriptions resources take effect immediately. Each resource’s API reference page notes specifically whether the methods for that resource use the «edits» model.
The Purchase Status API is part of the Google Play Developer API v. 2.0, available through the Google Developers Console.
Using the API
To start making API calls, you’ll set up and manage the Google Play Developer API directly from the Google Play Developer Console. The API can only be managed by the owner of your Google Play Developer account.
To access the API, you’ll need to:
- Set up a new or existing API project
- Set up one or more authorized clients, which can be either:
- OAuth clients
- service account
For full details, see the Google Play Developer API Getting Started page.
Staged Edits
The Google Play Developer Publishing API Edits methods allow you to prepare and commit changes to your Google Play apps. Once your update is ready to go, you can deploy it with a single operation. The changes you can make include:
- Uploading one or more APKs
- Assigning different APKs to different “tracks”: alpha, beta, staged rollout, and production
- Creating and modifying localized store listings for the app
- Uploading screenshots and other images for the app’s store listings
Once all the desired changes have been staged, they are all committed with a single operation.
For full details on staged edits, see the Google Play Developer API Edits page.
Note: The new, transactional «edits» functionality is only used by the Publishing API. Methods for the Subscriptions and In-App Purchases API take effect immediately. Each resource’s API reference page notes specifically whether the methods for that resource use the «edits» model.
Using the API Efficiently
Access to the Google Play Developer API is regulated to help ensure a high-performance environment for all applications that use it (as described in Quota). While you can request a higher daily quota for your application, we highly recommend that you minimize your access using these techniques:
- Limit the number of app updates — Do not publish alpha or beta updates more frequently than once a day. (Production apps should be updated even less frequently than that.) Every update costs your users time and possibly money. If you update too frequently, users will start ignoring updates, or even uninstall the product. (Of course, if there’s a major problem with your app, go ahead and fix it.)
- Query the Purchase Status API for new purchases only — At purchase, your app can pass the purchase token and other details to your backend servers, which can use the Purchase Status API to verify the purchase.
- Cache purchase details on your servers — To the extent possible, cache the purchase details for in-app products and subscriptions on your backend servers. If your app contacts your backend servers at runtime to verify purchase validity, your server can verify the purchase based on the cached details, to minimize use of the Purchase Status API and to provide the fastest possible response (and best experience) for the user.
- Store subscription expiry on your servers — Your servers should use the Purchase Status API to query the expiration date for new subscription tokens, then store the expiration date locally. This allows you to check the status of subscriptions only at or after the expiration (see below).
- Query for subscription status only at expiration — Once your server has retrieved the expiration date of subscription tokens, it should not query the Google Play servers for the subscription status again until the subscription is reaching or has passed the expiration date. Typically, your servers would run a batch query each day to check the status of expiring subscriptions, then update the database. Note that:
- Your servers should not query all subscriptions every day.
- Your servers should never query subscription status dynamically, based on individual requests from your Android application.
By following those general guidelines, your implementation will offer the best possible performance for users.
Quota
Applications using the Google Play Developer API are limited to an initial courtesy usage quota of 200,000 requests per day (per application). This should provide enough access for publishing activities and normal subscription-validation needs.
If you need to request a higher limit for your application, use the «Request more» link on the Quotas pane of the Google Developers Console.
Источник
Google Play Developer API
The Google Play Developer API allows you to perform a number of publishing and app-management tasks. It includes two components:
- The Subscriptions and In-App Purchases API lets you manage in-app purchases and subscriptions.
- The Publishing API lets you upload and publish apps, and perform other publishing-related tasks.
Subscriptions and In-App Purchases
You can use the Google Play Developer API to manage:
You can use these resources to check the status of purchases, and to modify and cancel recurring purchases.
To learn more about how to sell subscriptions in an Android app, read Google Play In-app Billing on the Android Developers site.
Publishing API
The Google Play Developer Publishing API allows you to automate frequent tasks having to do with app production and distribution. This provides functions similar to those available to a developer through the Play Console, such as:
- Uploading new versions of an app
- Releasing apps, by assigning APKs to various Tracks (alpha, beta, staged rollout, or production)
- Creating and modifying Google Play Store listings, including localized text and graphics and multi-device screenshots
Those tasks are performed using the new edits functionality, which take a transactional approach to making changes; you bundle several changes into a single draft edit, then commit the changes all at once. (None of the changes take effect until the edit is committed.)
Getting Started
To start using the Google Play Developer API, have a look at the Getting Started page.
There are Java and Python libraries you can use to manage interaction with the Publishing API. We have provided code samples on the Client Libraries and Code Samples page. If you are using other languages, you can access the REST APIs directly via HTTP.
If you’re having issues using the Google Play Developer API, we’re here to help.
Other APIs
The Google Play Games Services Publishing API allows you to automate frequent tasks having to do with game services production and distribution.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Источник
Google Play In-App Review API: пошаговое руководство по внедрению
Летом 2020 года появилась новая классная функциональность в библиотеке Play Core — In-App Review [1]. При помощи этой фичи можно реализовать диалог с отзывом и оценкой пользователя. Это очень удобно и не ломает пользовательский сценарий. Фича полезна для повышения рейтинга и продвижения. Например, после внедрения в одном из приложений количество оценок увеличилось в 5 раз [2]. В этой статье я расскажу, как внедрить In-App Review в ваше приложение.
Руководство
Добавление зависимостей
Добавьте в ваш build.gradle следующие зависимости:
Реализация
Добавьте следующий код для вызова диалога оценки приложения:
Также, если необходимо, добавьте флаг в SharedPreference , который можно проверять в случае, если вы хотите вызывать сценарий только один раз. Нужно иметь в виду, что диалог в целом может вызваться только ограниченное количество раз [3], a также при помощи API невозможно проверить — прошел ли пользователь ревью или нет [4]. Как добавить In-App Review в Unity или нативный код, читайте в следующей документации [5], [6].
Тестирование
Протестировать сценарий In-App Review можно только, если приложение было скачано через Google Play, поэтому есть два способа проверить сценарий руками:
- Internal Test Track: чтобы использовать этот механизм, нужно, чтобы ваше приложение было опубликовано в Google Play Store.
- Internal App Sharing: относительно новый механизм распространение тестовых версий приложений, который позволяет распростронять ваши .apk (или .aab) через Google Play.
Для Unit-тестирования API предоставляет нам класс FakeReviewManager . Далее расскажу как проверить сценарий In-App Review при помощи Internal App Sharing.
Internal app sharing
После того, как вы соберете ваш .apk (или .aab) и создадите новое приложение в Google Play, перейдите в раздел Internal App Sharing:
В нем вы можете управлять настройками рассылки приложения, например, задать списки с почтами, которым разрешено скачивать .apk (или .aab):
Можно также задать настройку, чтобы все, кто обладает ссылкой, могли скачать приложение без ограничений:
После того, как мы задали настройки, переходим на форму отправки https://play.google.com/console/u/0/internal-app-sharing и загружаем .apk (или .aab):
Копируем ссылку и отправляем адресату. Далее, как же получить наш архив? Для этого заходим в приложение Google Play на телефоне, открываем настройки, кликаем пять раз по “Play Store version”, и предоставляем внутренний доступ к приложениям, нажав на свитч:
После этого можно открыть ссылку и установить приложение:
В этом режиме кнопка отправки ревью не работает:
Но проверить работу сценария все равно можно.
Итоги
Google Play Core предоставил отличный инструмент для повышения рейтинга приложений, который можно с легкостью внедрить и протестировать. Тестирование In-App Review можно проводить только с .apk, которые были скачаны и установлены через Google Play Store, например, через механизм Internal App Sharing. Размер apk при этом увеличится на 100 KB, dex файл увеличится на 200 классов и 500 методов примерно, что, возможно, порадует разработчиков-оптимизаторов apk.
Источник