Engage SDK Integration
Android (Google)OfficialCreated by Google LLCDistributed by Android (Google)
- Skill
- Tool integration
- Software development
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured workflow for Android developers to integrate the Play Engage SDK. It covers the end-to-end process, including identifying vertical-specific requirements, generating necessary boilerplate code, mapping local data models to Engage entities, and configuring broadcast receivers for data synchronization. The skill also includes a verification checklist and troubleshooting guidance to ensure a robust implementation.
What it does
- Guides developers through vertical-specific Engage SDK integration steps.
- Generates boilerplate code for constants, entity converters, request factories, and workers.
- Assists in mapping local app models to required Engage entity schemas.
- Provides instructions for both static and dynamic broadcast receiver registration.
- Offers a self-verification checklist to ensure successful implementation.
- Provides troubleshooting steps for common compilation and integration errors.
When to use it
- When adding Play Engage SDK support to an Android application.
- When generating publishing code for recommendation or continuation clusters.
- When mapping existing local data classes to Engage-compatible entities.
- When debugging SDK-related errors or implementation issues.
Advantages
- Ensures adherence to mandatory SDK structure and entity requirements.
- Reduces manual effort by providing standardized code templates.
- Promotes best practices for background data synchronization.
- Simplifies the complex process of vertical-specific configuration.
Usage examples
- “How do I integrate the Engage SDK for my food delivery app?”
- The agent will identify the food vertical, guide you through selecting the appropriate cluster types, and generate the required boilerplate classes like ItemToEntityConverter and EngageWorker.
- “I am getting a background execution error with my broadcast receiver. How do I fix it?”
- The agent will instruct you to implement dynamic registration for your EngageBroadcastReceiver and verify that the correct permissions are handled.
- “How do I map my local restaurant data class to a StoreEntity?”
- The agent will analyze your data class, compare it against the food schema, and generate the conversion logic for your ItemToEntityConverter.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/android/engage-sdk-integration/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip engage-sdk-integration.zip -d .agents/skills
Documentation by Google LLC
This skill guides you through integrating the Play Engage SDK into an Android app. It ensures that the code follows the mandatory structure and uses the required Engage entities for each vertical.
Workflow
Follow these steps to assist the developer:
Identify vertical and cluster:
Ask the developer which vertical their app belongs to based on references/schemas/.
Check if the integration is for TV or mobile. If the integration is for TV, read the TV-specific sections in patterns.md as well.
Use
{VERTICAL}.mdin the references/schemas/ directory to identify the corresponding Engage entities and theclientclass name. Theclientfield in the JSON provides the full class name. For example,com.google.android.engage.food.service.AppEngageFoodClient.Note: Initializing the client class requires a
Contextparameter. For example,AppEngageFoodClient(context).Always refer to common.md for common entities.
Ask which cluster type they want to publish from the supported cluster types for that vertical.
Find the method to call from
{VERTICAL}.mdin the references/schemas/ directory for the specified cluster. Each method will specify the request it expects.Get the request structure from requests.md and clusters from clusters.md. Then suggest and use sources to fill the fields in the request structure correctly, along with the required entities and clusters.
Generate structured boilerplate code:
Create a new directory for all Engage-related code. Name the directory to match the naming convention of the existing codebase.
Generate the following classes using templates in patterns.md:
Constants: holds constant values such as attempt counts and publish types.ItemToEntityConverter: converts the app's local models to Engage's Entity models.ClusterRequestFactory: constructs the publish requests.EngageWorker: handles the actual publishing and publish errors using WorkManager.EngagePublisher: orchestrates periodic and one-time jobs.EngageBroadcastReceiver: listens for AppEngageService intents and starts a one-time publish job fromEngagePublisher. Important : Implement both static registration and dynamic registration patterns, including the companion objectregistermethod inside theEngageBroadcastReceiverclass.
Suggest entity mapping:
Ask the developer to provide their local model schema (for example, a data class or a JSON snippet).
If they haven't provided one, share entities from
{VERTICAL}.mdin the references/schemas/ directory as a guide.Once the local model is identified, suggest a mapping to the corresponding Engage entity.
Generate the conversion logic using the
ItemToEntityConverterpattern in patterns.md and add it to the generated{ENGAGE_CODE_DIR}/ItemToEntityConverter.
Suggest data source:
Ask the developer to provide the source of actual data you'll publish.
Once you identify the data source, use it to fetch the data in the app's local model schema.
Use
{ENGAGE_CODE_DIR}/ItemToEntityConverterto convert this data to an Engage entity.Use obtained Engage entity model data with
{ENGAGE_CODE_DIR}/ ClusterRequestFactoryto get cluster requests.Call corresponding cluster publishing method obtained from
{VERTICAL}.mdin the references/schemas/ directory with the obtained request in previous step in{ENGAGE_CODE_DIR}/EngageWorker.
Gradle and manifest updates:
Suggest updates to
build.gradleandAndroidManifest.xml.For mobile apps, use patterns.md.
For TV apps, use the TV-specific sections in patterns.md.
Provide the necessary
implementationdependencies forbuild.gradleorbuild.gradle.ktsfrom patterns.md.Provide the
<receiver>and<service>declarations forAndroidManifest.xml.Note: Except for TV, there aren't any vertical-specific imports. For all other verticals,
com.google.android.engage:engage-core:1.6.0is sufficient.
Debugging and verification:
Self-verification checklist : Before considering your work complete, you must verify that you've implemented all of the following:
[ ] Registered
EngageBroadcastReceiverstatically inAndroidManifest.xml(inside the<application>tag).[ ] Registered
EngageBroadcastReceiverdynamically by callingEngageBroadcastReceiver.register(context)in theApplicationclass or mainActivityclass.[ ] Implemented the
registermethod inEngageBroadcastReceiver'scompanion objectto handle dynamic registration.[ ] Handled empty data lists in
EngageWorker(for example, by deleting the cluster instead of publishing empty data).
Perform a Gradle sync.
If errors occur (such as import failures, namespace conflicts, or compile errors), read references/troubleshooting.md to resolve them.
Execute a Gradle compilation (
./gradlew compileDebugUnitTestSourcesor./gradlew assembleDebug). See references/troubleshooting.md for compile rules and warnings about fast-compilation shortcuts. Repeat this step until compilation is successful.
User checklist: At the end of code generation, notify the user to go through this checklist to verify that the integration is complete and as intended:
[ ] Verify that all the Engage-related files are created in
{ENGAGE_CODE_DIR}/:ConstantsItemToEntityConverterClusterRequestFactoryEngageWorker{cluster_type}PublisherEngageBroadcastReceiver
[ ] Verify that app's local model is converted to Engage entity by populating the fields correctly in the model in
{ENGAGE_CODE_DIR}/ItemToEntityConverter.[ ] Verify that all image URIs in
ItemToEntityConverterpoint to images matching the strict aspect ratio requirements of the vertical (for example, 16:9, 1:1, 2:3).[ ] Verify that
{ENGAGE_CODE_DIR}/EngageWorkeruses the data source identified in Step 4.[ ] Verify that
EngageBroadcastReceiver.register(context)is called within theApplicationclass orMainActivityto register the receiver dynamically.[ ] Verify that
AndroidManifest.xmlcontains the static<receiver>declaration forEngageBroadcastReceiverwith the necessary intent actions.Important : Explicitly instruct the developer to call
EngageBroadcastReceiver.register(context)inside their customApplicationclassonCreate()(or their main activityonCreate()) to dynamically register the receiver. Stress that both static and dynamic registrations are required for the integration to function.
Reference materials
FAQ: Engage FAQ - Refer to this document for answers to frequently asked questions from developers.
Vertical-specific guides:
Vertical-specific schemas:
Files
- ATTRIBUTION.mdAdded by AutoGineer973 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md9.2 KiB
- references/android/guide/playcore/engage/faq.md22.7 KiB
- references/android/guide/playcore/engage/food.md58.1 KiB
- references/android/guide/playcore/engage/healthandfitness.md62.0 KiB
- references/android/guide/playcore/engage/listen.md52.9 KiB
- references/android/guide/playcore/engage/otherverticals.md92.8 KiB
- references/android/guide/playcore/engage/read.md44.0 KiB
- references/android/guide/playcore/engage/shopping.md60.4 KiB
- references/android/guide/playcore/engage/social.md35.8 KiB
- references/android/guide/playcore/engage/travel.md102.3 KiB
- references/android/guide/playcore/engage/tv/continue-watching/index.md1.1 KiB
- references/android/guide/playcore/engage/tv/entitlements.md15.1 KiB
- references/android/guide/playcore/engage/tv/getting-started.md22.5 KiB
- references/android/guide/playcore/engage/tv/recommendations.md18.4 KiB
- references/android/guide/playcore/engage/watch.md59.9 KiB
- references/clusters.md5.9 KiB
- references/common.md17.9 KiB
- references/patterns.md21.3 KiB
- references/requests.md10.3 KiB
- references/schemas/food.md18.6 KiB
- references/schemas/listen.md29.9 KiB
- references/schemas/other.md8.0 KiB
- references/schemas/read.md15.0 KiB
- references/schemas/shopping.md13.5 KiB
- references/schemas/social.md8.5 KiB
- references/schemas/travel.md34.0 KiB
- references/schemas/tv.md46.9 KiB
- references/schemas/watch.md43.7 KiB
- references/troubleshooting.md2.0 KiB
references/android/guide/playcore/engage/read.md
[!IMPORTANT] Important: Engage SDK has superseded Media Home, which is now deprecated. If you have an existing Media Home integration, follow the instructions in these guides to migrate your content to Engage SDK, which allows your content to be published to more devices and form factors. Please contact
[email protected]if you have any questions.
Boost app engagement by reaching your users where they are. Integrate Engage SDK to deliver personalized recommendations and continuation content directly to users across multiple on-device surfaces, like Collections , Entertainment Space , and the Play Store. The integration adds less than 50 KB (compressed) to the average APK and takes most apps about a week of developer time. Learn more at our business site.
This guide contains instructions for developer partners to deliver reading content (eBooks, Audiobooks, Comics/Manga, Blogs, News and Magazines) to Engage content surfaces.
Category support and surfaces
Engage SDK surface eligibility is based on your app's content category. Use the following table to determine your eligibility for specific surfaces:
| Status | Content category or use case | Supported surfaces |
|---|---|---|
| Supported (Eligible on all surfaces) | - eBooks - Comics & Manga - Audiobooks - UGC long-form reading services - Blogs | - Collections - Entertainment Space - Play Store Apps tab - Play Store You tab (Personalized recommendations & continuation only) - Play Store store listing page |
| Partially supported (Eligible on some surfaces) | - News & Magazines* | - Collections - Entertainment Space |
| Not supported | - eBook or PDF reader - Book reviews - Encyclopedia / Dictionary - Translator - Religious text |
News apps
News apps provide diverse content, each subject to unique eligibility rules. Because Engage SDK content on the Play Store aligns with Play Premium Growth Tools, news articles and video clips from news apps are ineligible for the Play Store, though they are eligible for Collections and Entertainment Space. Conversely, non-traditional news content, like podcasts and recipes, may be eligible for the Play Store:
| Entity type | Eligible for Collections | Eligible for Entertainment Space | Eligible for Play Store |
|---|---|---|---|
| News article | Yes (Read tab) | Yes (Read tab) | No |
| Video clip | Yes (Watch tab) | Yes (Watch tab) | No |
| Podcast | Yes (Listen tab) | Yes (Listen tab) | Yes |
| Recipe | Yes (Food tab) | No | Yes |
[!NOTE] Note: Play Store eligibility aligns with the supported categories for Play Premium Growth Tools. If your news app has additional forms of content not listed in the preceding table, contact
[email protected]to clarify its eligibility for the Play Store.
Android skills
Integrate Engage SDK
Use the Engage SDK Android skill to integrate, debug, and resolve implementation issues. To install the skill from the Android CLI, run:
android skills add engage-sdk-integration<br />
Integration detail
This section details the steps, data models, and terminology required to integrate with the Engage SDK for reading content.
Terminology
This integration includes the following three cluster types: Recommendation , Continuation , and Featured.
Recommendation clusters show personalized suggestions for content to read from an individual developer partner.
Your recommendations take the following structure:
Recommendation Cluster: A UI view that contains a group of recommendations from a single developer partner.
Image: untitled Figure 1. Entertainment Space UI showing a Recommendation Cluster from a single partner.
Entity: An object representing a single item in a cluster. An entity can be an ebook, an audio book, a book series, and more. See the Provide entity data section for a list of supported entity types.
Image: untitled Figure 2. Entertainment Space UI showing a single Entity within a single partner's Recommendation Cluster.
The Continuation cluster shows unfinished books from multiple developer partners in a single UI grouping. Each developer partner will be allowed to broadcast a maximum of 10 entities in the Continuation cluster.
Image: untitled Figure 3. Entertainment Space UI showing a Continuation cluster with unfinished recommendations from multiple partners (only one recommendation is currently visible).
The Featured cluster showcases a selection of items from multiple developer partners in a single UI grouping. There will be a single Featured cluster, which is surfaced near the top of the UI with a priority placement above all Recommendation clusters. Each developer partner will be allowed to broadcast up to 10 entities in the Featured cluster.
Image: untitled Figure 4. Entertainment Space UI showing a Featured cluster with recommendations from multiple partners (only one recommendation is currently visible).
Pre-work
Minimum API level: 19
Add the com.google.android.engage:engage-core library to your app:
dependencies {
// Make sure you also include that repository in your project's build.gradle file.
implementation 'com.google.android.engage:engage-core:1.6.0'
}Summary
The design is based on an implementation of a bound service.
The data a client can publish is subject to the following limits for different cluster types:
| Cluster type | Cluster limits | Maximum entity limits in a cluster |
|---|---|---|
| Recommendation Cluster(s) | At most 7 | At most 50 |
| Continuation Cluster | At most 1 | At most 20 |
| Featured Cluster | At most 1 | At most 20 |
Step 1: Provide entity data
The SDK has defined different entities to represent each item type. We support the following entities for the Read category:
EbookEntityAudiobookEntityBookSeriesEntity
The following charts outline available attributes and requirements for each type.
EbookEntity
The EbookEntity object represents an ebook (for example, the ebook of
Becoming by Michelle Obama).
| Attribute | Requirement | Notes |
|---|---|---|
| Name | Required | |
| Poster images | Required | At least one image must be provided. See Image Specifications for guidance. |
| Author | Required | At least one author name must be provided. |
| Action link uri | Required | The deep link to the provider app for the ebook. Note: You can use deep links for attribution. Refer to this FAQ |
| Publish date | Optional | In epoch milliseconds if provided. |
| Description | Optional | Must be within 200 characters if provided. |
| Price | Optional | Free text |
| Page count | Optional | Must be a positive integer if provided. |
| Genre | Optional | List of genres associated with the book. |
| Series name | Optional | Name of the series that the ebook belongs to (for example, Harry Potter). |
| Series unit index | Optional | The index of the ebook in the series, where 1 is the first ebook in the series. For example, if Harry Potter and the Prisoner of Azkaban is the 3rd book in the series, this should be set to 3. |
| Continue book type | Optional | TYPE_CONTINUE - Resume on a unfinished book. TYPE_NEXT - Continue on a new one of a series. TYPE_NEW - Newly released. |
| Last Engagement Time | Conditionally required | Must be provided when the item is in the Continuation cluster. *Newly* acquired ebooks can be a part of the continue reading cluster. In epoch milliseconds. |
| Progress Percentage Complete | Conditionally required | Must be provided when the item is in the Continuation cluster. Value must be greater than 0 and less than 100. |
| DisplayTimeWindow - Set a time window for a content to be shown on the surface | ||
| Start Timestamp | Optional | The epoch timestamp after which the content should be shown on the surface. If not set, content is eligible to be shown on the surface. In epoch milliseconds. |
| End Timestamp | Optional | The epoch timestamp after which the content is no longer shown on the surface. If not set, content is eligible to be shown on the surface. In epoch milliseconds. |
AudiobookEntity
The AudiobookEntity object represents an audiobook (for example, the audiobook
of Becoming by Michelle Obama).
| Attribute | Requirement | Notes |
|---|---|---|
| Name | Required | |
| Poster images | Required | At least one image must be provided. See Image Specifications for guidance. |
| Author | Required | At least one author name must be provided. |
| Action link uri | Required | The deep link to the provider app for the audiobook. Note: You can use deep links for attribution. Refer to this FAQ |
| Narrator | Optional | At least one narrator's name must be provided. |
| Publish date | Optional | In epoch milliseconds if provided. |
| Description | Optional | Must be within 200 characters if provided. |
| Price | Optional | Free text |
| Duration | Optional | Must be a positive value if provided. |
| Genre | Optional | List of genres associated with the book. |
| Series name | Optional | Name of the series that the audiobook belongs to (for example, Harry Potter. |
| Series unit index | Optional | The index of the audiobook in the series, where 1 is the first audiobook in the series. For example, if Harry Potter and the Prisoner of Azkaban is the 3rd book in the series, this should be set to 3. |
| Continue book type | Optional | TYPE_CONTINUE - Resume on a unfinished book. TYPE_NEXT - Continue on a new one of a series. TYPE_NEW - Newly released. |
| Last Engagement Time | Conditionally required | Must be provided when the item is in the Continuation cluster. In epoch milliseconds. |
| Progress Percentage Complete | Conditionally required | Must be provided when the item is in the Continuation cluster. *Newly* acquired audiobooks can be a part of the continue reading cluster. Value must be greater than 0 and less than 100. |
| DisplayTimeWindow - Set a time window for a content to be shown on the surface | ||
| Start Timestamp | Optional | The epoch timestamp after which the content should be shown on the surface. If not set, content is eligible to be shown on the surface. In epoch milliseconds. |
| End Timestamp | Optional | The epoch timestamp after which the content is no longer shown on the surface. If not set, content is eligible to be shown on the surface. In epoch milliseconds. |
BookSeriesEntity
The BookSeriesEntity object represents a book series (for example, the Harry
Potter book series, which has 7 books).
| Attribute | Requirement | Notes |
|---|---|---|
| Name | Required | |
| Poster images | Required | At least one image must be provided. See Image Specifications for guidance. |
| Author | Required | At least one author name must be present. |
| Action link uri | Required | The deep link to the provider app for the audiobook or ebook. Note: You can use deep links for attribution. Refer to this FAQ |
| Book count | Required | Number of books in the series. |
| Description | Optional | Must be within 200 characters if provided. |
| Genre | Optional | List of genres associated with the book. |
| Continue book type | Optional | TYPE_CONTINUE - Resume on a unfinished book. TYPE_NEXT - Continue on a new one of a series. TYPE_NEW - Newly released. |
| Last Engagement Time | Conditionally required | Must be provided when the item is in the Continuation cluster. In epoch milliseconds. |
| Progress Percentage Complete | Conditionally required | Must be provided when the item is in the Continuation cluster. *Newly* acquired book series can be a part of the continue reading cluster. Value must be greater than 0 and less than 100. |
| DisplayTimeWindow - Set a time window for a content to be shown on the surface | ||
| Start Timestamp | Optional | The epoch timestamp after which the content should be shown on the surface. If not set, content is eligible to be shown on the surface. In epoch milliseconds. |
| End Timestamp | Optional | The epoch timestamp after which the content is no longer shown on the surface. If not set, content is eligible to be shown on the surface. In epoch milliseconds. |
Image specifications
The following table lists the required specifications for image assets:
| Aspect ratio | Supported cluster(s) | Minimum pixels | Recommended pixels |
|---|---|---|---|
| Square (1x1) | All clusters | 300x300 | 1200x1200 |
| Landscape (1.91x1) | Featured and continuation | 600x314 | 1200x628 |
| Portrait (4x5) | Recommendation | 480x600 | 960x1200 |
File formats
PNG, JPG, static GIF, WebP
Maximum file size
5120 KB
Additional recommendations
Image safe area: Put your important content in the center 80% of the image.
Example
AudiobookEntity audiobookEntity =
new AudiobookEntity.Builder()
.setName("Becoming")
.addPosterImage(
new Image.Builder()
.setImageUri(Uri.parse("http://www.x.com/image.png"))
.setImageHeightInPixel(960)
.setImageWidthInPixel(408)
.build())
.addAuthor("Michelle Obama")
.addNarrator("Michelle Obama")
.setActionLinkUri(Uri.parse("https://play.google/audiobooks/1"))
.setDurationMillis(16335L)
.setPublishDateEpochMillis(1633032895L)
.setDescription("An intimate, powerful, and inspiring memoir")
.setPrice("$16.95")
.addGenre("biography")
.build();Step 2: Provide Cluster data
It's recommended to have the content publish job executed in the background (for example, using WorkManager) and scheduled on a regular basis or on an event basis (for example, every time the user opens the app or when the user just added something to their cart).
AppEngagePublishClient is responsible for publishing clusters. Following
APIs are available in the client:
isServiceAvailablepublishRecommendationClusterspublishFeaturedClusterpublishContinuationClusterpublishUserAccountManagementRequestupdatePublishStatusdeleteRecommendationsClustersdeleteFeaturedClusterdeleteContinuationClusterdeleteUserManagementClusterdeleteClusters
isServiceAvailable
This API is used to check if the service is available for integration and whether the content can be presented on the device.
For Engage SDK v1.6.0 and higher (Recommended)
Android skills
Engage SDK integration
To install the skill from the Android CLI, run:
android skills add engage-sdk-integrationIf your team uses AI coding tools (such as Gemini in Android Studio), you can automate this migration by prompting your AI assistant:
Use the engage-sdk-integration skill to use Engage SDK 1.6.0 and refactor isServiceAvailable to pass ServiceAvailabilityRequest for publishing all cluster types.<br />
You can check the service availability for every cluster type that you intend to
publish. The isServiceAvailable API accepts a request object,
ServiceAvailabilityRequest, which contains the cluster types for which service
availability needs to be checked. You can find the ClusterType enum values
required for ServiceAvailabilityRequest from the following table.
| Cluster Type | Cluster Type Constant | Integer Value |
|---|---|---|
| Unknown | TYPE_UNKNOWN | 0 |
| Recommendation Cluster | TYPE_RECOMMENDATION | 1 |
| Featured Cluster | TYPE_FEATURED | 2 |
| Continuation Cluster | TYPE_CONTINUATION | 3 |
| User Management Cluster | TYPE_ENGAGEMENT | 8 |
| Subscription Cluster | TYPE_SUBSCRIPTION | 12 |
Kotlin
val request = ServiceAvailabilityRequest.Builder()
.addIntendedClusterType(ClusterType.TYPE_CONTINUATION)
.addIntendedClusterType(ClusterType.TYPE_RECOMMENDATION)
.build()
client.isServiceAvailable(request).addOnCompleteListener { task ->
if (task.isSuccessful) {
val availabilityMap = task.result
if (availabilityMap[ClusterType.TYPE_CONTINUATION] == true) {
// Proceed with publishing continuation content
}
if (availabilityMap[ClusterType.TYPE_RECOMMENDATION] == true) {
// Proceed with publishing recommendation content
}
} else {
// The IPC call itself fails, proceed with error handling logic here,
// such as retry.
}
}Java
ServiceAvailabilityRequest request =
new ServiceAvailabilityRequest.Builder()
.addIntendedClusterType(ClusterType.TYPE_CONTINUATION)
.addIntendedClusterType(ClusterType.TYPE_RECOMMENDATION)
.build();
client.isServiceAvailable(request).addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Map<Integer, Boolean> availabilityMap = task.getResult();
if (Boolean.TRUE.equals(availabilityMap.get(ClusterType.TYPE_CONTINUATION))) {
// Proceed with publishing continuation content
}
if (Boolean.TRUE.equals(availabilityMap.get(ClusterType.TYPE_RECOMMENDATION))) {
// Proceed with publishing recommendation content
}
} else {
// The IPC call itself fails, proceed with error handling logic here such as retry.
}
});Conditional Service Availability Feature
Some integrated apps request a special configuration that enables and disables the Engage service intermittently to reduce serving costs. However, this intermittent content ingestion strategy negatively affects the user experience: stale content won't be presented, and some surfaces won't be served.
Starting with v1.6.0, the Engage SDK allows checking availability for specific cluster types. If your app uses intermittent ingestion:
Continuation clusters (such as Continue Reading) remain enabled by default across all supported devices.
Other cluster types (such as Recommendations) are enabled and disabled intermittently.
If this default configuration isn't suitable for your needs, contact [email protected].
For SDK versions prior to v1.6.0 (Deprecated)
Kotlin
client.isServiceAvailable.addOnCompleteListener { task ->
if (task.isSuccessful) {
// Handle IPC call success
if(task.result) {
// Service is available on the device, proceed with content publish
// calls.
} else {
// Service is not available, no further action is needed.
}
} else {
// The IPC call itself fails, proceed with error handling logic here,
// such as retry.
}
}Java
client.isServiceAvailable().addOnCompleteListener(task - > {
if (task.isSuccessful()) {
// Handle success
if(task.getResult()) {
// Service is available on the device, proceed with content publish
// calls.
} else {
// Service is not available, no further action is needed.
}
} else {
// The IPC call itself fails, proceed with error handling logic here,
// such as retry.
}
});[!NOTE] Note: We highly recommend keeping a periodic job running to check if the service becomes available at a later point in time. The availability of the service may change with Android version upgrades, app upgrades, installs, and uninstalls. By ensuring periodic job checks at a certain time interval, data can be published once the service becomes available.
publishRecommendationClusters
This API is used to publish a list of RecommendationCluster objects.
[!IMPORTANT] Important: The publish APIs are upsert APIs; it replaces the existing content. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently.
Kotlin
client.publishRecommendationClusters(
PublishRecommendationClustersRequest.Builder()
.addRecommendationCluster(
RecommendationCluster.Builder()
.addEntity(entity1)
.addEntity(entity2)
.setTitle("Reconnect with yourself")
.build())
.build())Java
client.publishRecommendationClusters(
new PublishRecommendationClustersRequest.Builder()
.addRecommendationCluster(
new RecommendationCluster.Builder()
.addEntity(entity1)
.addEntity(entity2)
.setTitle("Reconnect with yourself")
.build())
.build());When the service receives the request, the following actions take place within one transaction:
Existing
RecommendationClusterdata from the developer partner is removed.Data from the request is parsed and stored in the updated Recommendation Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
publishFeaturedCluster
This API is used to publish a list of FeaturedCluster objects.
[!IMPORTANT] Important: The publish APIs are upsert APIs; it replaces the existing content. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently.
Kotlin
client.publishFeaturedCluster(
PublishFeaturedClusterRequest.Builder()
.setFeaturedCluster(
FeaturedCluster.Builder()
...
.build())
.build())Java
client.publishFeaturedCluster(
new PublishFeaturedClusterRequest.Builder()
.setFeaturedCluster(
new FeaturedCluster.Builder()
...
.build())
.build());When the service receives the request, the following actions take place within one transaction:
Existing
FeaturedClusterdata from the developer partner is removed.Data from the request is parsed and stored in the updated Featured Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
publishContinuationCluster
This API is used to publish a ContinuationCluster object.
[!IMPORTANT] Important: The publish APIs are upsert APIs; it replaces the existing content. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently.
Kotlin
client.publishContinuationCluster(
PublishContinuationClusterRequest.Builder()
.setContinuationCluster(
ContinuationCluster.Builder()
.addEntity(book_entity1)
.addEntity(book_entity2)
.build())
.build())Java
client.publishContinuationCluster(
PublishContinuationClusterRequest.Builder()
.setContinuationCluster(
ContinuationCluster.Builder()
.addEntity(book_entity1)
.addEntity(book_entity2)
.build())
.build())When the service receives the request, the following actions take place within one transaction:
Existing
ContinuationClusterdata from the developer partner is removed.Data from the request is parsed and stored in the updated Continuation Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
publishUserAccountManagementRequest
This API is used to publish a Sign In card . The signin action directs users to the app's sign in page so that the app can publish content (or provide more personalized content)
The following metadata is part of the Sign In Card -
| Attribute | Requirement | Description |
|---|---|---|
| Action Uri | Required | Deeplink to Action (i.e. navigates to app sign in page) |
| Image | Optional - If not provided, Title must be provided | Image Shown on the Card 16x9 aspect ratio images with a resolution of 1264x712 |
| Title | Optional - If not provided, Image must be provided | Title on the Card |
| Action Text | Optional | Text Shown on the CTA (i.e. Sign in) |
| Subtitle | Optional | Optional Subtitle on the Card |
[!IMPORTANT] Important: The publish APIs are upsert APIs; it replaces the existing content. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently.
Kotlin
var SIGN_IN_CARD_ENTITY =
SignInCardEntity.Builder()
.addPosterImage(
Image.Builder()
.setImageUri(Uri.parse("http://www.x.com/image.png"))
.setImageHeightInPixel(500)
.setImageWidthInPixel(500)
.build())
.setActionText("Sign In")
.setActionUri(Uri.parse("http://xx.com/signin"))
.build()
client.publishUserAccountManagementRequest(
PublishUserAccountManagementRequest.Builder()
.setSignInCardEntity(SIGN_IN_CARD_ENTITY)
.build());Java
SignInCardEntity SIGN_IN_CARD_ENTITY =
new SignInCardEntity.Builder()
.addPosterImage(
new Image.Builder()
.setImageUri(Uri.parse("http://www.x.com/image.png"))
.setImageHeightInPixel(500)
.setImageWidthInPixel(500)
.build())
.setActionText("Sign In")
.setActionUri(Uri.parse("http://xx.com/signin"))
.build();
client.publishUserAccountManagementRequest(
new PublishUserAccountManagementRequest.Builder()
.setSignInCardEntity(SIGN_IN_CARD_ENTITY)
.build());When the service receives the request, the following actions take place within one transaction:
Existing
UserAccountManagementClusterdata from the developer partner is removed.Data from the request is parsed and stored in the updated UserAccountManagementCluster Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
updatePublishStatus
If for any internal business reason, none of the clusters is published, we strongly recommend updating the publish status using the updatePublishStatus API. This is important because :
Providing the status in all scenarios, even when the content is published (STATUS == PUBLISHED), is critical to populate dashboards that use this explicit status to convey the health and other metrics of your integration.
If no content is published but the integration status isn't broken (STATUS == NOT_PUBLISHED), Google can avoid triggering alerts in the app health dashboards. It confirms that content is not published due to an expected situation from the provider's standpoint.
It helps developers provide insights into when the data is published versus not.
Google may use the status codes to nudge the user to do certain actions in the app so they can see the app content or overcome it.
The list of eligible publish status codes are :
// Content is published
AppEngagePublishStatusCode.PUBLISHED,
// Content is not published as user is not signed in
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN,
// Content is not published as user is not subscribed
AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SUBSCRIPTION,
// Content is not published as user location is ineligible
AppEngagePublishStatusCode.NOT_PUBLISHED_INELIGIBLE_LOCATION,
// Content is not published as there is no eligible content
AppEngagePublishStatusCode.NOT_PUBLISHED_NO_ELIGIBLE_CONTENT,
// Content is not published as the feature is disabled by the client
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_FEATURE_DISABLED_BY_CLIENT,
// Content is not published as the feature due to a client error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_CLIENT_ERROR,
// Content is not published as the feature due to a service error
// Available in v1.3.1
AppEngagePublishStatusCode.NOT_PUBLISHED_SERVICE_ERROR,
// Content is not published due to some other reason
// Reach out to engage-developers@ before using this enum.
AppEngagePublishStatusCode.NOT_PUBLISHED_OTHERIf the content is not published due to a user not logged in, Google would recommend publishing the Sign In Card. If for any reason providers are not able to publish the Sign In Card then we recommend calling the updatePublishStatus API with the status code NOT_PUBLISHED_REQUIRES_SIGN_IN
Kotlin
client.updatePublishStatus(
PublishStatusRequest.Builder()
.setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
.build())Java
client.updatePublishStatus(
new PublishStatusRequest.Builder()
.setStatusCode(AppEngagePublishStatusCode.NOT_PUBLISHED_REQUIRES_SIGN_IN)
.build());deleteRecommendationsClusters
This API is used to delete the content of Recommendation Clusters.
[!IMPORTANT] Important: Delete APIs should only be called when there is no content to publish. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently. Reach out to
[email protected]before using delete APIs.
Kotlin
client.deleteRecommendationsClusters()Java
client.deleteRecommendationsClusters();When the service receives the request, it removes the existing data from the Recommendation Clusters. In case of an error, the entire request is rejected and the existing state is maintained.
[!NOTE] Note: This api is available from version 1.1.0 onwards.
deleteFeaturedCluster
This API is used to delete the content of Featured Cluster.
[!IMPORTANT] Important: Delete APIs should only be called when there is no content to publish. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently. Reach out to
[email protected]before using delete APIs.
Kotlin
client.deleteFeaturedCluster()Java
client.deleteFeaturedCluster();When the service receives the request, it removes the existing data from the Featured Cluster. In case of an error, the entire request is rejected and the existing state is maintained.
[!NOTE] Note: This api is available from version 1.1.0 onwards.
deleteContinuationCluster
This API is used to delete the content of Continuation Cluster.
[!IMPORTANT] Important: Delete APIs should only be called when there is no content to publish. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently. Reach out to
[email protected]before using delete APIs.
Kotlin
client.deleteContinuationCluster()Java
client.deleteContinuationCluster();When the service receives the request, it removes the existing data from the Continuation Cluster. In case of an error, the entire request is rejected and the existing state is maintained.
[!NOTE] Note: This api is available from version 1.1.0 onwards.
deleteUserManagementCluster
This API is used to delete the content of UserAccountManagement Cluster.
[!IMPORTANT] Important: Delete APIs should only be called when there is no content to publish. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently. Reach out to
[email protected]before using delete APIs.
Kotlin
client.deleteUserManagementCluster()Java
client.deleteUserManagementCluster();When the service receives the request, it removes the existing data from the UserAccountManagement Cluster. In case of an error, the entire request is rejected and the existing state is maintained.
[!NOTE] Note: This api is available from version 1.1.0 onwards.
deleteClusters
This API is used to delete the content of a given cluster type.
[!IMPORTANT] Important: Delete APIs should only be called when there is no content to publish. Don't call delete and publish APIs subsequently to replace the content as the publish APIs do that inherently. Reach out to
[email protected]before using delete APIs.
Kotlin
client.deleteClusters(
DeleteClustersRequest.Builder()
.addClusterType(ClusterType.TYPE_FEATURED)
.addClusterType(ClusterType.TYPE_RECOMMENDATION)
...
.build())Java
client.deleteClusters(
new DeleteClustersRequest.Builder()
.addClusterType(ClusterType.TYPE_FEATURED)
.addClusterType(ClusterType.TYPE_RECOMMENDATION)
...
.build());When the service receives the request, it removes the existing data from all clusters matching the specified cluster types. Clients can choose to pass one or many cluster types. In case of an error, the entire request is rejected and the existing state is maintained.
Error handling
It is highly recommended to listen to the task result from the publish APIs such that a follow-up action can be taken to recover and resubmit an successful task.
client.publishRecommendationClusters(
new PublishRecommendationClustersRequest.Builder()
.addRecommendationCluster(...)
.build())
.addOnCompleteListener(
task -> {
if (task.isSuccessful()) {
// do something
} else {
Exception exception = task.getException();
if (exception instanceof AppEngageException) {
@AppEngageErrorCode
int errorCode = ((AppEngageException) exception).getErrorCode();
if (errorCode == AppEngageErrorCode.SERVICE_NOT_FOUND) {
// do something
}
}
}
});The error is returned as an AppEngageException with the cause included as an
error code.
| Error code | Error name | Note |
|---|---|---|
1 | SERVICE_NOT_FOUND | The service is not available on the given device. |
2 | SERVICE_NOT_AVAILABLE | The service is available on the given device, but it is not available at the time of the call (for example, it is explicitly disabled). |
3 | SERVICE_CALL_EXECUTION_FAILURE | The task execution failed due to threading issues. In this case, it can be retried. |
4 | SERVICE_CALL_PERMISSION_DENIED | The caller is not allowed to make the service call. |
5 | SERVICE_CALL_INVALID_ARGUMENT | The request contains invalid data (for example, more than the allowed number of clusters). |
6 | SERVICE_CALL_INTERNAL | There is an error on the service side. |
7 | SERVICE_CALL_RESOURCE_EXHAUSTED | The service call is made too frequently. |
Step 3: Handle broadcast intents
In addition to making publish content API calls through a job, it is also
required to set up a
BroadcastReceiver to receive
the request for a content publish.
The goal of broadcast intents is mainly for app reactivation and forcing data sync. Broadcast intents are not designed to be sent very frequently. It is only triggered when the Engage Service determines the content might be stale (for example, a week old). That way, there is more confidence that the user can have a fresh content experience, even if the application has not been executed for a long period of time.
The BroadcastReceiver must be set up in the following two ways:
Dynamically register an instance of the
BroadcastReceiverclass usingContext.registerReceiver(). This enables communication from applications that are still live in memory.
Kotlin
class AppEngageBroadcastReceiver : BroadcastReceiver(){
// Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION broadcast
// is received
// Trigger featured cluster publish when PUBLISH_FEATURED broadcast is received
// Trigger continuation cluster publish when PUBLISH_CONTINUATION broadcast is
// received
}
fun registerBroadcastReceivers(context: Context){
var context = context
context = context.applicationContext
// Register Recommendation Cluster Publish Intent
context.registerReceiver(AppEngageBroadcastReceiver(),
IntentFilter(Intents.ACTION_PUBLISH_RECOMMENDATION),
com.google.android.engage.service.BroadcastReceiverPermissions.BROADCAST_REQUEST_DATA_PUBLISH_PERMISSION,
/*scheduler=*/null)
// Register Featured Cluster Publish Intent
context.registerReceiver(AppEngageBroadcastReceiver(),
IntentFilter(Intents.ACTION_PUBLISH_FEATURED),
com.google.android.engage.service.BroadcastReceiverPermissions.BROADCAST_REQUEST_DATA_PUBLISH_PERMISSION,
/*scheduler=*/null)
// Register Continuation Cluster Publish Intent
context.registerReceiver(AppEngageBroadcastReceiver(),
IntentFilter(Intents.ACTION_PUBLISH_CONTINUATION),
com.google.android.engage.service.BroadcastReceiverPermissions.BROADCAST_REQUEST_DATA_PUBLISH_PERMISSION,
/*scheduler=*/null)
}Java
class AppEngageBroadcastReceiver extends BroadcastReceiver {
// Trigger recommendation cluster publish when PUBLISH_RECOMMENDATION broadcast
// is received
// Trigger featured cluster publish when PUBLISH_FEATURED broadcast is received
// Trigger continuation cluster publish when PUBLISH_CONTINUATION broadcast is
// received
}
public static void registerBroadcastReceivers(Context context) {
context = context.getApplicationContext();
// Register Recommendation Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_RECOMMENDATION),
com.google.android.engage.service.BroadcastReceiverPermissions.BROADCAST_REQUEST_DATA_PUBLISH_PERMISSION,
/*scheduler=*/null);
// Register Featured Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_FEATURED),
com.google.android.engage.service.BroadcastReceiverPermissions.BROADCAST_REQUEST_DATA_PUBLISH_PERMISSION,
/*scheduler=*/null);
// Register Continuation Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.engage.service.Intents.ACTION_PUBLISH_CONTINUATION),
com.google.android.engage.service.BroadcastReceiverPermissions.BROADCAST_REQUEST_DATA_PUBLISH_PERMISSION,
/*scheduler=*/null);
}Statically declare an implementation with the
<receiver>tag in yourAndroidManifest.xmlfile. This allows the application to receive broadcast intents when it is not running, and also allows the application to publish the content.<application> <receiver android:name=".AppEngageBroadcastReceiver" android:permission="com.google.android.engage.REQUEST_ENGAGE_DATA" android:exported="true" android:enabled="true"> <intent-filter> <action android:name="com.google.android.engage.action.PUBLISH_RECOMMENDATION" /> </intent-filter> <intent-filter> <action android:name="com.google.android.engage.action.PUBLISH_FEATURED" /> </intent-filter> <intent-filter> <action android:name="com.google.android.engage.action.PUBLISH_CONTINUATION" /> </intent-filter> </receiver> </application>
The following intents will be sent by the service:
com.google.android.engage.action.PUBLISH_RECOMMENDATIONIt is recommended to start apublishRecommendationClusterscall when receiving this intent.com.google.android.engage.action.PUBLISH_FEATUREDIt is recommended to start apublishFeaturedClustercall when receiving this intent.com.google.android.engage.action.PUBLISH_CONTINUATION
It is recommended to start apublishContinuationCluster` call when receiving this intent.
Integration workflow
For a step-by-step guide on verifying your integration after it is complete, see Engage developer integration workflow.
FAQs
See Engage SDK Frequently Asked Questions for FAQs.
Contact
Contact [email protected] if there are any questions during
the integration process. Our team will reply as soon as possible.
Next steps
After completing this integration, your next steps are as follows:
Send an email to
[email protected]and attach your integrated APK that is ready for testing by Google.Google will perform a verification and review internally to make sure the integration works as expected. If changes are needed, Google will contact you with any necessary details.
When testing is complete and no changes are needed, Google will contact you to notify you that you can start publishing the updated and integrated APK to the Play Store.
After Google has confirmed that your updated APK has been published to the Play Store, your Recommendation , Featured , and Continuation clusters will be published and visible to users.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Google LLC
- Publisher
- Android (Google) (Official)
- Distributed by
- Android (Google)
- Source
- android/skills · play/engage-sdk-integration · commit bf68e2d
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE.txt)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google LLC or Android (Google).
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download engage-sdk-integration.zip