Selector businessSelector = new SelectorBuilder()
.fields("Id", "GeoPoint")
.equals("Id", String.valueOf(businessId))
.build();
ExpressBusiness business = businessService.get(businessSelector).getEntries(0);
// Get the PromotionService
PromotionServiceInterface promotionService =
adWordsServices.get(session, PromotionServiceInterface.class);
// PromotionService requires the businessId on the session
session.setExpressBusinessId(businessId);
// Set up the new Promotion
Promotion marsTourPromotion = new Promotion();
Money budget = new Money();
budget.setMicroAmount(1000000L);
marsTourPromotion.setName("Mars Tour Promotion " + System.currentTimeMillis());
marsTourPromotion.setStatus(PromotionStatus.PAUSED);
marsTourPromotion.setDestinationUrl("http://www.example.com");
marsTourPromotion.setBudget(budget);
marsTourPromotion.setCallTrackingEnabled(true);
// Criteria
List<Criterion> criteria = Lists.newArrayList();
// Criterion - Travel Agency product/service. See GetProductServices.java for an example
// of how to get valid product/service settings.
ProductService productService = new ProductService();
productService.setText("Travel Agency");
productService.setLocale("en_US");
criteria.add(productService);
// Criterion - English language
// The ID can be found in the documentation:
// https://developers.google.com/adwords/api/docs/appendix/languagecodes
Language language = new Language();
language.setId(1000L);
criteria.add(language);
// Criterion - Within 15 miles
Proximity proximity = new Proximity();
proximity.setGeoPoint(business.getGeoPoint());
proximity.setRadiusDistanceUnits(ProximityDistanceUnits.MILES);
proximity.setRadiusInUnits(15d);
criteria.add(proximity);
marsTourPromotion.setCriteria(criteria.toArray(new Criterion[criteria.size()]));