SDK Events (.NET)

Description

When initializing the SDK, an optional OnDeviceDecisioningReady delegate can be provided on the TargetClientConfig object, which will be invoked when the SDK is ready for on-device method calls. There are also a couple other delegates available for handling the on-device decisioning artifact download.

Events

The following delegates can be configured for certain events:

Name
Arguments
Description
OnDeviceDecisioningReady
None
Called only once the first time the client is ready for on-device decisioning
ArtifactDownloadSucceeded
string contents of artifact file
Called every time an on-device decisioning artifact is downloaded
ArtifactDownloadFailed
Exception
Called every time there is a failure to download an on-device decisioning artifact

Example

.NET

var clientConfig = new TargetClientConfig.Builder("acmeclient", "1234567890@AdobeOrg")
    .SetDecisioningMethod(DecisioningMethod.OnDevice)
    .SetOnDeviceDecisioningReady(DecisioningReady)
    .SetArtifactDownloadSucceeded(artifact => Console.WriteLine("The artifact was successfully downloaded. Contents: " + artifact))
    .SetArtifactDownloadFailed(exception => Console.WriteLine("The artifact failed to download. Exception: " + exception.Message))
    .Build();

var targetClient = TargetClient.Create(clientConfig);

// ...

static void DecisioningReady()
{
    var mboxRequests = new List<MboxRequest> { new (index: 1, name: "a1-serverside-ab") };

    var targetDeliveryRequest = new TargetDeliveryRequest.Builder()
        .SetExecute(new ExecuteRequest(mboxes: mboxRequests))
        .Build();

    var targetResponse = targetClient.GetOffers(targetDeliveryRequest);
}
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3