Collection<File> uploadMediaBundles = FileUtils.listFiles(new 
File(campaignItem.html5_path), null, false);
if (uploadMediaBundles.size() > 0) {
    MediaServiceInterface mediaService =
            adWordsServices.get(session, MediaServiceInterface.class);
    ArrayList<MediaBundle> mediaBundles = new ArrayList<>();
    ArrayList<String> md5List = new ArrayList<>();
    for (File file : uploadMediaBundles) {
        String fileName = file.getAbsolutePath().toLowerCase();
        if (fileName.endsWith("zip")) {
            MediaBundle mediaBundle = new MediaBundle();
            mediaBundle.setData(
                    
com.google.api.ads.common.lib.utils.Media.getMediaDataFromFile(file));
            mediaBundle.setType(MediaMediaType.MEDIA_BUNDLE);

            mediaBundles.add(mediaBundle);
        }
    }
    if (mediaBundles.size() > 0) {
        Media[] media = new Media[mediaBundles.size()];
        for (int i = 0; i < mediaBundles.size(); i++) {
            media[i] = mediaBundles.get(i);
        }
        
        Media[] result = mediaService.upload(media);

    
        long[] mediaIds = new long[result.length];
        for (int i = 0; i < result.length; i++) {
            mediaIds[i] = result[i].getMediaId();
        }
        universalAppSetting.setImageMediaIds(mediaIds);
    }
}


CampaignService Method: mutate clientCustomerId: 590-416-6793 URL: 
https://adwords.google.com/api/adwords/cm/v201708/CampaignService Request 
ID: 0005626678a389790a6267986302ce02 ResponseTime(ms): 497 OperationsCount: 
1 IsFault: true FaultMessage: 
ApiException{applicationExceptionType=ApiException, 
errors=[SettingError{apiErrorType=SettingError, 
errorString=SettingError.MEDIA_INCOMPATIBLE_FOR_UNIVERSAL_APP_CAMPAIGN, 
fieldPath=operations[0].operand.settings[0].imageMediaIds[0], 
fieldPathElements=[FieldPathElement{field=operations, index=0}, 
FieldPathElement{field=operand}, FieldPathElement{field=settings, index=0}, 
FieldPathElement{field=imageMediaIds, index=0}], 
reason=MEDIA_INCOMPATIBLE_FOR_UNIVERSAL_APP_CAMPAIGN, trigger=3356164502}]}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/0499ea77-09f7-4fb7-a37f-8cde445b59f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • When you create ... mengjunzhu837

Reply via email to