Android: Regions
Overview
For more details about regions, you can read to the Regions reference.
Details
You can add .setRegionId()
in your builder request. Here is an example for a Home request:
Placement placement = new Placement(Placement.PlacementType.HOME, "<placement name>"); RichRelevance.buildRecommendationsForPlacements(placement) .setRegionId("1337") .setCallback(new Callback<PlacementResponseInfo>() { @Override public void onResult(PlacementResponseInfo result) { int index = 0; for(PlacementResponse placement : result.getPlacements()) { for(final RecommendedProduct recommendedProduct : placement.getRecommendedProducts()) { // Add your view init logic. The actual implementation will depend on your code. // In this example we will assume items are rendered as TableRows in a TableView. TableRow row = new TableRow(context); row.setId(index); row.addView(detailView); index++; tableView.addLayout(row); } } } @Override public void onError(Error error) { // Use this code block to handle errors Log.e(getClass().getSimpleName(), "Error: " + error.getMessage()); } }).execute();