Utils.GuestUserID = sharedPref.getSharedPref(getResources()的getString(R.string.guest_user)。); ClientConfiguration clientConfiguration = new ClientConfiguration(“hjsd767443”,“gdfg63476473”); clientConfiguration.setUserId(Utils.GuestUserID); clientConfiguration.setSessionId(UUID.randomUUID()的toString()); RichRelevance.init(this,clientConfiguration);
RichRelevance.setLoggingLevel(RRLog.VERBOSE);
PlacementsRecommendationsBuilder placementsRecommendationsBuilder=new PlacementsRecommendationsBuilder();
placementsRecommendationsBuilder.setProductIds(IDProduct);
Placement placement = new Placement(Placement.PlacementType.ITEM, "Item page.recs_1mw");
RichRelevance.buildRecommendationsForPlacements(placement)
// Attach a callback
.setCallback(new Callback<PlacementResponseInfo>() {
@Override
public void onResult(PlacementResponseInfo result) {
PlacementResponse placement = result.getPlacements().get(0);
RecommendedProduct product = placement.getRecommendedProducts().get(0);
product.trackClick();
}
@Override
public void onError(com.richrelevance.Error error) {
Log.e(getClass().getSimpleName(), "Error: " + error.getMessage());
}
})
// Execute the request
.execute();
答案 0 :(得分:0)
我认为您的问题出在“展示位置”设置中:
Placement placement = new Placement(Placement.PlacementType.ITEM, "Item page.recs_1mw");
应该成为
Placement placement = new Placement(Placement.PlacementType.ITEM, "recs_1mw");
因为您已经使用第一个参数指定了PageType / PlacementType。
答案 1 :(得分:0)
Utils.GuestUserID = sharedPref.getSharedPref(getResources()的getString(R.string.guest_user)。); com.richrelevance.ClientConfiguration clientConfiguration = new com.richrelevance.ClientConfiguration(&#34; gdhg76476437gh&#34;,&#34; hfdjj627642547&#34;); clientConfiguration.setUserId(Utils.GuestUserID); clientConfiguration.setSessionId(UUID.randomUUID()的toString()); clientConfiguration.setEndpoint(Endpoints.PRODUCTION,true); RichRelevance.init(this,clientConfiguration); 展示位置展示=新展示位置(Placement.PlacementType.ITEM,&#34; recs_1mw&#34;); PlacementsRecommendationsBuilder placementmentRecommendationsBuilder = new PlacementsRecommendationsBuilder(); placementsRecommendationsBuilder.setPlacements(放置); placementsRecommendationsBuilder.setProductIds(IDProduct);
placementsRecommendationsBuilder.setCallback(new Callback<PlacementResponseInfo>() {
@Override
public void onResult(PlacementResponseInfo placementResponseInfo) {
PlacementResponse placement = placementResponseInfo.getPlacements().get(0);
Log.e("placement rich:",placement.toString());
RecommendedProduct product = placement.getRecommendedProducts().get(0);
}
@Override
public void onError(Error error) {
}
}).execute();