Language

CustomAudienceManager.LeaveCustomAudience Method

Definition

Attempts to remove a user from a custom audience by deleting any existing CustomAudience data, identified by ownerPackageName, buyer, and name.

[Android.Runtime.Register("leaveCustomAudience", "(Landroid/adservices/customaudience/LeaveCustomAudienceRequest;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetLeaveCustomAudience_Landroid_adservices_customaudience_LeaveCustomAudienceRequest_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=34)]
[Android.Runtime.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")]
public virtual void LeaveCustomAudience(Android.AdServices.CustomAudiences.LeaveCustomAudienceRequest leaveCustomAudienceRequest, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver receiver);
[<Android.Runtime.Register("leaveCustomAudience", "(Landroid/adservices/customaudience/LeaveCustomAudienceRequest;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetLeaveCustomAudience_Landroid_adservices_customaudience_LeaveCustomAudienceRequest_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=34)>]
[<Android.Runtime.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")>]
abstract member LeaveCustomAudience : Android.AdServices.CustomAudiences.LeaveCustomAudienceRequest * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.LeaveCustomAudience : Android.AdServices.CustomAudiences.LeaveCustomAudienceRequest * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit

Parameters

leaveCustomAudienceRequest
LeaveCustomAudienceRequest

The non-null request containing the buyer and audience name to remove for the calling application.

executor
IExecutor

This value cannot be null. Service callbacks are dispatched through this executor. Some errors when accessing the service can be delivered directly to the receiver. To dispatch service callbacks through the main thread, use MainExecutor. Otherwise, provide an executor that dispatches to an appropriate thread.

receiver
IOutcomeReceiver

The non-null callback for the operation. In the Android 16 AOSP source, it can receive a result or an exception; a result does not indicate whether the audience previously existed. In the Android 17 AOSP source, both service callbacks report an exception.

Attributes

Remarks

Attempts to remove a user from a custom audience by deleting any existing CustomAudience data, identified by ownerPackageName, buyer, and name.

This call fails with an SecurityException if

  1. the ownerPackageName is not calling app's package name; and/or
  2. the buyer is not authorized to use the API.

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

This call does not inform the caller whether the custom audience specified existed in on-device storage. In other words, it will fail silently when a buyer attempts to leave a custom audience that was not joined.

Java documentation for android.adservices.customaudience.CustomAudienceManager.leaveCustomAudience(android.adservices.customaudience.LeaveCustomAudienceRequest, java.util.concurrent.Executor, android.os.OutcomeReceiver<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