SDK事件(.NET)
描述
在初始化SDK时,可在TargetClientConfig
对象中提供可选的OnDeviceDecisioningReady
委派,当SDK准备好进行设备上方法调用时,将调用该委派。 还有几个其他代理人可用于处理on-device decisioning工件下载。
事件
可以为某些事件配置以下委派:
名称
参数
描述
OndeviceDecisioningReady
无
在客户端第一次为on-device decisioning准备就绪时只调用一次
ArtifactDownloadSucceeded
工件文件的字符串内容
每次下载on-device decisioning工件时调用
ArtifactDownloadFailed
例外
每次下载on-device decisioning工件失败时调用
示例
.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