*/
public class GetMobileAdUnitSizes {
public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
// Get the InventoryService.
InventoryServiceInterface inventoryService =
dfpServices.get(session, InventoryServiceInterface.class);
// Create a statement to select ad unit sizes available for the mobile
// platform.
StatementBuilder statementBuilder = new StatementBuilder()
.where("targetPlatform = :targetPlatform")
.withBindVariableValue("targetPlatform", TargetPlatform.MOBILE.toString());
// Get all ad unit sizes.
AdUnitSize[] adUnitSizes =
inventoryService.getAdUnitSizesByStatement(statementBuilder.toStatement());
if (adUnitSizes != null) {
for (int i = 0; i < adUnitSizes.length; i++) {
AdUnitSize adUnitSize = adUnitSizes[i];
System.out.printf("%s) Web ad unit size of dimensions %s was found.\n", i,