@@ -115,7 +115,7 @@ private static class AddSmartCampaignParams extends CodeSampleParams {
115115 "The ID of a Google My Business (GMB) location. This is required if a business name is"
116116 + " not provided. It can be retrieved using the GMB API, for details see:"
117117 + " https://developers.google.com/my-business/reference/rest/v4/accounts.locations" )
118- private Long locationId ;
118+ private String locationId ;
119119
120120 @ Parameter (
121121 names = ArgumentNames .BUSINESS_NAME ,
@@ -139,7 +139,7 @@ public static void main(String[] args) throws IOException {
139139 params .freeFormKeywordText = null ;
140140
141141 // Must specify one of location ID or business name.
142- params .locationId = Long . valueOf ( "INSERT_BUSINESS_LOCATION_ID_HERE" ) ;
142+ params .locationId = "INSERT_BUSINESS_LOCATION_ID_HERE" ;
143143 params .businessName = "INSERT_BUSINESS_NAME" ;
144144 }
145145
@@ -185,17 +185,24 @@ private void runExample(
185185 long customerId ,
186186 String keyword ,
187187 String freeFormKeywordText ,
188- Long locationId ,
188+ String locationId ,
189189 String businessName ) {
190190 if (locationId == null && businessName == null ) {
191191 throw new RuntimeException ("Must provider either --locationId or --businessName" );
192192 }
193+
194+ // [START add_smart_campaign_14]
195+ // Converts the location ID to unsigned long (potentially contains IDs with the most significant
196+ // bit set).
197+ long locationIdParsed = Long .parseUnsignedLong (locationId );
198+ // [END add_smart_campaign_14]
199+
193200 // [START add_smart_campaign_12]
194201 // Gets the SmartCampaignSuggestionInfo object which acts as the basis for many of the
195202 // entities necessary to create a Smart campaign. It will be reused a number of times to
196203 // retrieve suggestions for keyword themes, budget amount, ad creatives, and campaign criteria.
197204 SmartCampaignSuggestionInfo suggestionInfo =
198- getSmartCampaignSuggestionInfo (googleAdsClient , locationId , businessName );
205+ getSmartCampaignSuggestionInfo (googleAdsClient , locationIdParsed , businessName );
199206
200207 // Generates a list of keyword themes using the SuggestKeywordThemes method on the
201208 // SmartCampaignSuggestService. It is strongly recommended that you use this strategy for
@@ -238,7 +245,7 @@ private void runExample(
238245 Arrays .asList (
239246 createCampaignBudgetOperation (customerId , suggestedDailyBudgetMicros ),
240247 createSmartCampaignOperation (customerId ),
241- createSmartCampaignSettingOperation (customerId , locationId , businessName ),
248+ createSmartCampaignSettingOperation (customerId , locationIdParsed , businessName ),
242249 createAdGroupOperation (customerId ),
243250 createAdGroupAdOperation (customerId , adSuggestions )));
244251 operations .addAll (
0 commit comments