// Create inventory targeting.
InventoryTargeting inventoryTargeting = new InventoryTargeting();
inventoryTargeting.setTargetedPlacementIds(targetedPlacementIds);
// Create technology targeting.
TechnologyTargeting technologyTargeting = new TechnologyTargeting();
// Create device manufacturer targeting.
DeviceManufacturerTargeting deviceManufacturerTargeting = new DeviceManufacturerTargeting();
deviceManufacturerTargeting.setIsTargeted(true);
// Target the Google device manufacturer (40100).
Technology deviceManufacturerTechnology = new Technology();
deviceManufacturerTechnology.setId(40100L);
deviceManufacturerTargeting
.setDeviceManufacturers(new Technology[] {deviceManufacturerTechnology});
technologyTargeting.setDeviceManufacturerTargeting(deviceManufacturerTargeting);
// Create mobile device targeting.
MobileDeviceTargeting mobileDeviceTargeting = new MobileDeviceTargeting();
// Exclude the Nexus One device (604046).
Technology mobileDeviceTechnology = new Technology();
mobileDeviceTechnology.setId(604046L);
mobileDeviceTargeting.setExcludedMobileDevices(new Technology[] {mobileDeviceTechnology});
technologyTargeting.setMobileDeviceTargeting(mobileDeviceTargeting);
// Create mobile device submodel targeting.
MobileDeviceSubmodelTargeting mobileDeviceSubmodelTargeting =
new MobileDeviceSubmodelTargeting();
// Target the iPhone 4 device submodel (640003).
Technology mobileDeviceSubmodelTechnology = new Technology();
mobileDeviceSubmodelTechnology.setId(640003L);
mobileDeviceSubmodelTargeting
.setTargetedMobileDeviceSubmodels(new Technology[] {mobileDeviceSubmodelTechnology});
technologyTargeting.setMobileDeviceSubmodelTargeting(mobileDeviceSubmodelTargeting);
// Create targeting.
Targeting targeting = new Targeting();
targeting.setInventoryTargeting(inventoryTargeting);
targeting.setTechnologyTargeting(technologyTargeting);