CustomAudienceManager.ScheduleCustomAudienceUpdate Method

Definition

Allows the API caller to schedule a deferred Custom Audience update.

[Android.Runtime.Register("scheduleCustomAudienceUpdate", "(Landroid/adservices/customaudience/ScheduleCustomAudienceUpdateRequest;Ljava/util/concurrent/Executor;Landroid/adservices/common/AdServicesOutcomeReceiver;)V", "GetScheduleCustomAudienceUpdate_Landroid_adservices_customaudience_ScheduleCustomAudienceUpdateRequest_Ljava_util_concurrent_Executor_Landroid_adservices_common_AdServicesOutcomeReceiver_Handler", ApiSince=35)]
[Android.Runtime.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")]
public virtual void ScheduleCustomAudienceUpdate (Android.AdServices.CustomAudiences.ScheduleCustomAudienceUpdateRequest request, Java.Util.Concurrent.IExecutor executor, Android.AdServices.Common.IAdServicesOutcomeReceiver receiver);
[<Android.Runtime.Register("scheduleCustomAudienceUpdate", "(Landroid/adservices/customaudience/ScheduleCustomAudienceUpdateRequest;Ljava/util/concurrent/Executor;Landroid/adservices/common/AdServicesOutcomeReceiver;)V", "GetScheduleCustomAudienceUpdate_Landroid_adservices_customaudience_ScheduleCustomAudienceUpdateRequest_Ljava_util_concurrent_Executor_Landroid_adservices_common_AdServicesOutcomeReceiver_Handler", ApiSince=35)>]
[<Android.Runtime.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")>]
abstract member ScheduleCustomAudienceUpdate : Android.AdServices.CustomAudiences.ScheduleCustomAudienceUpdateRequest * Java.Util.Concurrent.IExecutor * Android.AdServices.Common.IAdServicesOutcomeReceiver -> unit
override this.ScheduleCustomAudienceUpdate : Android.AdServices.CustomAudiences.ScheduleCustomAudienceUpdateRequest * Java.Util.Concurrent.IExecutor * Android.AdServices.Common.IAdServicesOutcomeReceiver -> unit

Parameters

executor
IExecutor
Attributes

Remarks

Allows the API caller to schedule a deferred Custom Audience update. For each update the user will be able to join or leave a set of CustomAudiences.

This API only guarantees minimum delay to make the update, and does not guarantee a maximum deadline within which the update request would be made. Scheduled updates could be batched and queued together to preserve system resources, thus exact delay time is not guaranteed.

In order to conserve system resources the API will make and update request only if the following constraints are satisfied

<ol> <li>The device is using an un-metered internet connection <li>The device battery is not low <li>The device storage is not low </ol>

When the deferred update is triggered the API makes a POST request to the provided updateUri with the request body containing a JSON of Partial Custom Audience list.

An example of request body containing list of Partial Custom Audiences would look like:

{@code
            {
                "partial_custom_audience_data": [
                    {
                        "name": "running_shoes",
                        "activation_time": 1644375856883,
                        "expiration_time": 1644375908397
                    },
                    {
                        "name": "casual_shirt",
                        "user_bidding_signals": {
                            "signal1": "value1"
                        }
                    }
                ]
            }
            }

In response the API expects a JSON in return with following keys:

<ol> <li>"join" : Should contain list containing full data for a CustomAudience object <li>"leave" : List of CustomAudience names that user is intended to be removed from </ol>

An example of JSON in response would look like:

{@code
            {
                "join": [
                    {
                        "name": "running-shoes",
                        "activation_time": 1680603133,
                        "expiration_time": 1680803133,
                        "user_bidding_signals": {
                            "signal1": "value"
                        },
                        "trusted_bidding_data": {
                            "trusted_bidding_uri": "https://example-dsp.com/",
                            "trusted_bidding_keys": [
                                "k1",
                                "k2"
                            ]
                        },
                        "bidding_logic_uri": "https://example-dsp.com/...",
                        "ads": [
                            {
                                "render_uri": "https://example-dsp.com/...",
                                "metadata": {},
                                "ad_filters": {
                                    "frequency_cap": {
                                        "win": [
                                            {
                                                "ad_counter_key": "key1",
                                                "max_count": 2,
                                                "interval_in_seconds": 60
                                            }
                                        ],
                                        "view": [
                                            {
                                                "ad_counter_key": "key2",
                                                "max_count": 10,
                                                "interval_in_seconds": 3600
                                            }
                                        ]
                                    },
                                    "app_install": {
                                        "package_names": [
                                            "package.name.one"
                                        ]
                                    }
                                }
                            }
                        ]
                    },
                    {}
                ],
                "leave": [
                    "tennis_shoes",
                    "formal_shirt"
                ]
            }
            }

An attempt to register the user for a custom audience from the same application with the same combination of buyer inferred from Update Uri, and name will cause the existing custom audience's information to be overwritten, including the list of ads data.

In case information related to any of the CustomAudience to be joined is malformed, the deferred update would silently ignore that single Custom Audience

When removing this API attempts to remove a user from a custom audience by deleting any existing CustomAudience identified by owner i.e. calling app, buyer inferred from Update Uri, and name

Any partial custom audience field set by the caller cannot be overridden by the custom audience fetched from the updateUri. Given multiple Custom Audiences could be returned by a DSP we will match the override restriction based on the names of the Custom Audiences. A DSP may skip returning a full Custom Audience for any Partial Custom Audience in request.

In case the API encounters transient errors while making the network call for update, like 5xx, connection timeout, rate limit exceeded it would employ retries, with backoff up to a 'retry limit' number of times. The API would also honor 'retry-after' header specifying the min amount of seconds by which the next request should be delayed.

In a scenario where server responds with a '429 status code', signifying 'Too many requests', API would place the deferred update and other updates for the same requester i.e. caller package and buyer combination, in a quarantine. The quarantine records would be referred before making any calls for requesters, and request will only be made once the quarantine period has expired. The applications can leverage the `retry-after` header to self-quarantine for traffic management to their servers and prevent being overwhelmed with requests. The default quarantine value will be set to 30 minutes.

This call fails with an SecurityException if

<ol> <li>the ownerPackageName is not calling app's package name; and/or <li>the buyer, inferred from updateUri, is not authorized to use the API. </ol>

This call fails with an IllegalArgumentException if

<ol> <li>the provided updateUri is invalid or malformed. <li>the provided delayTime is not within permissible bounds <li>the combined size of partialCustomAudience list is larger than allowed limits </ol>

This call fails with LimitExceededException if the calling package exceeds the allowed rate limits and is throttled.

Java documentation for android.adservices.customaudience.CustomAudienceManager.scheduleCustomAudienceUpdate(android.adservices.customaudience.ScheduleCustomAudienceUpdateRequest, java.util.concurrent.Executor, android.adservices.common.AdServicesOutcomeReceiver<java.lang.Object, java.lang.Exception>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to