Google is building an on-device surface that organizes users' apps by verticals and enables a new immersive experience for personalized app content consumption and discovery. This fullscreen experience provides developer partners with an opportunity to showcase their best rich content in a dedicated channel outside of their app.
This guide contains instructions for developer partners to integrate their food content, using the Engage SDK to populate both this new surface area and existing Google surfaces.
Integration detail
Terminology
This integration includes the following five cluster types: Recommendation, Featured, Food Shopping Cart, Food Shopping List, and Reorder.
Recommendation clusters show personalized food-related suggestions from an individual developer partner. These recommendations can be personalized to the user or generalized (for example, new on sale). Use them to surface recipes, stores, dishes, groceries, and so on as you see fit.
- A Recommendation cluster can be made of
ProductEntity
,StoreEntity
, orRecipeEntity
listings, but not a mix of different entity types.
- A Recommendation cluster can be made of
The Featured cluster showcases the chosen hero
ProductEntity
,StoreEntity
, orRecipeEntity
from many developer partners in one UI grouping. There will be a single Feature cluster, which will be surfaced near the top of the UI, with a priority placement above all Recommendation clusters. Each developer partner will be allowed to broadcast a single entity of a supported type in Featured, with many entities (potentially of different types) from multiple app developers in the Featured cluster.The Food Shopping Cart cluster shows a sneak peek of grocery shopping carts from multiple developer partners in one UI grouping, prompting users to complete their outstanding carts. There will be a single Food Shopping Cart cluster.
- Food Shopping Cart Cluster must show the total count of items in the cart and may also include images for X items in the user's cart.
The Food Shopping List cluster shows a sneak peek of the grocery shopping lists from multiple developer partners in one UI grouping, prompting users to return to the corresponding app to update and complete their lists. There will be a single Food Shopping List cluster.
The Reorder cluster shows a sneak peek of the previous orders from multiple developer partners in one UI grouping, prompting users to reorder. There will be a single Reorder cluster.
Reorder cluster must show the total count of items in the user's previous order and must also include one of the following:
- Images for X items in the user's previous order.
- Labels for X items in the user's previous order.
Pre-work
Minimum API level: 19
Add the com.google.android.play:engage
library to your app:
dependencies {
// Make sure you also include that repository in your project's build.gradle file.
implementation 'com.google.android.play:engage:1.7.0-alpha'
}
To make the Engage SDK function for devices with Android 11 and above, declare the following in the manifest file:
<queries>
<package android:name="com.android.vending" />
</queries>
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 5 | At most 25 (ProductEntity , RecipeEntity , or
StoreEntity ) |
Featured Cluster | At most 1 | At most 1 (ProductEntity , RecipeEntity , or
StoreEntity ) |
Food Shopping Cart Cluster | At most 1 | At most 1 ShoppingCartEntity |
Food Shopping List Cluster | At most 1 | At most 1 ShoppingListEntity |
Reorder Cluster | At most 1 | At most 1 ReorderEntity |
Step 1: Provide entity data
The SDK has defined different entities to represent each item type. We support the following entities for the Food category:
ProductEntity
StoreEntity
RecipeEntity
FoodShoppingCart
FoodShoppingList
ReorderCluster
The charts below outline available attributes and requirements for each type.
ProductEntity
The ProductEntity
object represents an individual item (such as a grocery
item, dish from a restaurant, or a promotion) that developer partners want to
publish.
Attribute | Requirement | Description | Format |
---|---|---|---|
Poster images | Required | At least one image must be provided. | See Image Specifications for guidance. |
Action Uri | Required | The deep link to the page in the app displaying details about the product. | Uri |
Title | Optional | The name of the product. | Free text Recommended text size: under 90 chars (Text that is too long will show ellipses) |
Price - current | Conditionally required | The current price of the product. Must be provided if strikethrough price is provided. |
Free text |
Price - strikethrough | Optional | The original price of the entity, which will be struck-through in the UI. | Free text |
Callout | Optional | Callout to feature a promo, event, or update for the product, if available. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Callout fine print | Optional | Fine print text for the callout. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Note: All ratings will be displayed using our standard star rating system. | |||
Rating - max value | Conditionally required | The maximum value of the rating scale. Must be provided if current value of rating is also provided. |
Number >= 0.0 |
Rating - current value | Conditionally required | The current value of the entity's rating. Must be provided if maximum value of rating is also provided. |
Number >= 0.0 |
Rating - count | Optional | The count of ratings for the entity. | Integer >= 0 |
StoreEntity
The StoreEntity
object represents an individual store that developer partners
want to publish, such as a restaurant or a grocery store.
Attribute | Requirement | Description | Format |
---|---|---|---|
Poster images | Required | At least one image must be provided. | See Image Specifications for guidance. |
Action Uri | Required | The deep link to the page in the app displaying details about the store. | Uri |
Title | Optional | The name of the store. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Location | Optional | The location of the store. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Callout | Optional | Callout to feature a promo, event, or update for the store, if available. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Callout fine print | Optional | Fine print text for the callout. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Description | Optional | A description of the store. | Free text Recommended text size: under 90 chars (Text that is too long will show ellipses) |
Note: All ratings will be displayed using our standard star rating system. | |||
Rating - max value | Conditionally required | The maximum value of the rating scale. Must be provided if current value of rating is also provided. |
Number >= 0.0 |
Rating - current value | Conditionally required | The current value of the entity's rating. Must be provided if maximum value of rating is also provided. |
Number >= 0.0 |
Rating - count | Optional | The count of ratings for the entity. | Integer >= 0 |
RecipeEntity
The RecipeEntity
object represents a recipe item that developer partners want
to publish.
Attribute | Requirement | Description | Format |
---|---|---|---|
Poster images | Required | At least one image must be provided. | See Image Specifications for guidance. |
Action Uri | Required | The deep link to the page in the app displaying details about the recipe. | Uri |
Title | Optional | The name of the recipe. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Author | Optional | The author of the recipe. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Cook/Preparation time | Optional | The cooking time of the recipe. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Callout | Optional | Callout to feature a promo, event, or update for the recipe, if available. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Category | Optional | The category of the recipe. | Free text Recommended text size: under 45 chars (Text that is too long will show ellipses) |
Description | Optional | A description of the recipe. | Free text Recommended text size: under 90 chars (Text that is too long will show ellipses) |
Note: All ratings will be displayed using our standard star rating system. | |||
Rating - max value | Conditionally required | The maximum value of the rating scale. Must be provided if current value of rating is also provided. |
Number >= 0.0 |
Rating - current value | Conditionally required | The current value of the entity's rating. Must be provided if maximum value of rating is also provided. |
Number >= 0.0 |
Rating - count | Optional | The count of ratings for the entity. | Integer >= 0 |
FoodShoppingCart
Attribute | Requirement | Description | Format |
---|---|---|---|
Action Uri | Required | The deep link to the shopping cart in the partner’s app. | Uri |
Number of items | Required | The number of items (not just number of products) in the shopping cart. For example: If there are 3 oranges and 1 apple in the cart, this number should be 4. |
Integer >= 1 |
Title | Optional | The title of the cart (for example, Your cart). If no title is provided by the developer, Your cart is the default. |
Free text Recommended text size: under 25 chars (Text that is too long will show ellipses) |
Cart images | Optional | Images of each product in the cart. Up to 10 images can be provided in order of priority; the actual number of images displayed depends on the device form factor. |
See Image Specifications for guidance. |
FoodShoppingList
Attribute | Requirement | Description | Format |
---|---|---|---|
Action Uri | Required | The deep link to the shopping list in the partner’s app. | Uri |
Number of items | Required | The number of items in the shopping list. | Integer >= 1 |
Title | Optional | The title of the list (for example, Your Grocery List). If no title is provided by the developer, Shopping list is the default. |
Free text Recommended text size: under 25 chars (Text that is too long will show ellipses) |
Item labels | Required | The list of labels for items on the shopping list. At least 1 label must be provided and up to 10 labels can be provided in order of priority; the actual number of labels displayed depends on the device form factor. |
List of free text labels Recommended text size: under 20 chars (Text that is too long will show ellipses) |
ReorderCluster
Attribute | Requirement | Description | Format |
---|---|---|---|
Action Uri | Required | The deep link to reorder in the partner’s app. | Uri |
Number of items | Required | The number of items (not just number of products) in the previous order. For example: If there were 3 small coffees and 1 croissant in the previous order, this number should be 4. |
Integer >= 1 |
Title | Required | The title of the reorder item. | Free text Recommended text size: under 40 chars (Text that is too long will show ellipses) |
Item labels | Optional (If not provided, poster images should be provided) |
The list of item labels for the previous order. Up to 10 labels can be provided in order of priority; the actual number of labels displayed depends on the device form factor. |
List of free text Recommended text size per label: under 20 chars (Text that is too long will show ellipses) |
Poster images | Optional (If not provided, item labels should be provided) |
Images of the items in the previous order. Up to 10 images can be provided in order of priority; the actual number of images displayed depends on the device form factor. |
See Image Specifications for guidance. |
Image specifications
Required specifications for image assets are listed below:
Aspect ratio | Minimum pixels | Recommended pixels |
---|---|---|
Square (1x1) Preferred |
300x300 | 1200x1200 |
Landscape (1.91x1) | 600x314 | 1200x628 |
Portrait (4x5) | 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.
- Use a transparent background so that the image can be properly displayed in Dark and Light theme settings.
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).
There are seven APIs to publish clusters in the client:
AppEngagePublishClient#isServiceAvailable
AppEngagePublishClient#publishRecommendationClusters
AppEngagePublishClient#publishFeaturedCluster
AppEngageFoodClient#publishFoodShoppingCart
AppEngageFoodClient#publishFoodShoppingList
AppEngageFoodClient#publishReorderCluster
AppEngagePublishClient#deleteClusters
API #1: isServiceAvailable
This API is used to check if the service is available for integration and whether the content can be presented on the device.
Task<Boolean> isAvailableTask = client.isServiceAvailable();
isAvailableTask.addOnCompleteListener(task - > {
if (resultTask.isSuccessful()) {
// Handle success
}
});
API #2: publishRecommendationClusters
This API is used to publish a list RecommendationCluster
objects.
A RecommendationCluster
object can have the following attributes:
Attribute | Requirement | Description |
---|---|---|
List of ProductEntity, StoreEntity, or RecipeEntity | Required | A list of entities that make up the recommendations for this Recommendation Cluster. Entities in a single cluster must be of the same type. |
Title | Required | The title for the Recommendation Cluster (for example, Big savings on Thanksgiving menu). Recommended text size: under 25 chars (Text that is too long will show ellipses) |
Action Uri | Optional | The deep link to the page in the partner app where users can see the complete list of recommendations. |
Task<Void> task = client.publishRecommendationClusters(
new PublishRecommendationClustersRequest.Builder()
.addRecommendationCluster(
new RecommendationCluster.Builder()
.addEntity(entity1)
.addEntity(entity2)
.setTitle("Big savings on Thanksgiving menu")
.build())
.build());
When the service receives the request, the following actions take place within one transaction:
- All existing Recommendation Cluster data is removed.
- Data from the request is parsed and stored in new Recommendation Clusters.
In case of an error, the entire request is rejected and the existing state is maintained.
API #3: publishFeaturedCluster
This API is used to publish a FeaturedCluster
object.
Task<Void> task = client.publishFeaturedCluster(
new PublishFeaturedClusterRequest.Builder()
.setFeaturedCluster(
new FeaturedCluster.Builder()
.addEntity(entity1)
.addEntity(entity2)
.build())
.build());
When the service receives the request, the following actions take place within one transaction:
- Existing
FeaturedCluster
data 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.
API #4: publishFoodShoppingCart
This API is used to publish a FoodShoppingCart
object.
Task<Void> task = client.publishFoodShoppingCart(
new PublishFoodShoppingCartClusterRequest.Builder()
.setShoppingCart(
new FoodShoppingCart.Builder()
...
.build())
.build();
When the service receives the request, the following actions take place within one transaction:
- Existing
FoodShoppingCart
data from the developer partner is removed. - Data from the request is parsed and stored in the updated Shopping Cart Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
API #5: publishFoodShoppingList
This API is used to publish a FoodShoppingList
object.
Task<Void> task = client.publishFoodShoppingList(
new PublishFoodShoppingListRequest.Builder()
.setFoodShoppingList(
new FoodShoppingListEntity.Builder()
...
.build())
.build());
When the service receives the request, the following actions take place within one transaction:
- Existing
FoodShoppingList
data from the developer partner is removed. - Data from the request is parsed and stored in the updated Shopping List Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
API #6: publishReorderCluster
This API is used to publish a ReorderCluster
object.
Task<Void> task = client.publishReorderCluster(
new PublishReorderRequest.Builder()
.setReorderCluster(
new ReorderCluster.Builder()
...
.build())
.build());
When the service receives the request, the following actions take place within one transaction:
- Existing
ReorderCluster
data from the developer partner is removed. - Data from the request is parsed and stored in the updated Reorder Cluster.
In case of an error, the entire request is rejected and the existing state is maintained.
API #7: deleteClusters
This API is used to delete the content of a given cluster type.
Task<Void> task =
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 | Note |
---|---|
SERVICE_NOT_FOUND |
The service is not available on the given device. |
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). |
SERVICE_CALL_EXECUTION_FAILURE |
The task execution failed due to threading issues. In this case, it can be retried. |
SERVICE_CALL_PERMISSION_DENIED |
The caller is not allowed to make the service call. |
SERVICE_CALL_INVALID_ARGUMENT |
The request contains invalid data (for example, more than the allowed number of clusters). |
SERVICE_CALL_INTERNAL |
There is an error on the service side. |
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
BroadcastReceiver
class usingContext.registerReceiver()
. This enables communication from applications that are still live in memory.
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 shopping cart cluster publish when PUBLISH_SHOPPING_CART broadcast is
// received
// Trigger shopping list cluster publish when PUBLISH_SHOPPING_LIST broadcast is
// received
// Trigger reorder cluster publish when PUBLISH_REORDER 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.play.engage.service.Intents.ACTION_PUBLISH_RECOMMENDATION));
// Register Featured Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.play.engage.service.Intents.ACTION_PUBLISH_FEATURED));
// Register Shopping Cart Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.play.engage.food.service.Intents.ACTION_PUBLISH_FOOD_SHOPPING_CART));
// Register Shopping List Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.play.engage.food.service.Intents.ACTION_PUBLISH_FOOD_SHOPPING_LIST));
// Register Reorder Cluster Publish Intent
context.registerReceiver(new AppEngageBroadcastReceiver(),
new IntentFilter(com.google.android.play.engage.food.service.Intents.ACTION_PUBLISH_REORDER_CLUSTER));
}
- Statically declare an implementation with the
<receiver>
tag in yourAndroidManifest.xml
file. 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:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.play.engage.action.PUBLISH_RECOMMENDATION" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.play.engage.action.PUBLISH_FEATURED" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.play.engage.action.food.PUBLISH_SHOPPING_CART" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.play.engage.action.food.PUBLISH_SHOPPING_LIST" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.play.engage.action.food.PUBLISH_REORDER" />
</intent-filter>
</receiver>
</application>
The following intents will be sent by the service:
com.google.android.play.engage.action.PUBLISH_RECOMMENDATION
It is recommended to start apublishRecommendationClusters
call when receiving this intent.com.google.android.play.engage.action.PUBLISH_FEATURED
It is recommended to start apublishFeaturedCluster
call when receiving this intent.com.google.android.play.engage.action.food.PUBLISH_SHOPPING_CART
It is recommended to start apublishShoppingCart
call when receiving this intent.com.google.android.play.engage.action.food.PUBLISH_SHOPPING_LIST
It is recommended to start apublishShoppingList
call when receiving this intent.com.google.android.play.engage.action.shopping.PUBLISH_REORDER
It is recommended to start apublishReorder
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
Please contact engage-developers@google.com 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 engage-developers@google.com 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, Shopping Cart, Shopping List, and Reorder clusters will be published and visible to users.