報告事件要求
public
class
ReportEventRequest
extends Object
java.lang.Object | |
↳ | android.adservices.adselection.ReportEventRequest |
要求物件,該物件會包裝回報廣告事件所需的必要引數。
摘要
巢狀類別 | |
---|---|
class |
ReportEventRequest.Builder
|
常數 | |
---|---|
int |
FLAG_REPORTING_DESTINATION_BUYER
|
int |
FLAG_REPORTING_DESTINATION_SELLER
|
公用方法 | |
---|---|
long
|
getAdSelectionId()
傳回 adSelectionId,亦即廣告選擇程序的主要 ID。 |
String
|
getData()
傳回廣告事件資料。 |
InputEvent
|
getInputEvent()
傳回與使用者互動相關聯的輸入事件。 |
String
|
getKey()
傳回事件鍵,也就是要回報的廣告事件類型。 |
int
|
getReportingDestinations()
傳回要回報到哪個報表目的地的位元欄位 (買家、賣家或兩者)。 |
繼承方法 | |
---|---|
常數
FLAG_REPORTING_DESTINATION_BUYER
public static final int FLAG_REPORTING_DESTINATION_BUYER
常數值:2 (0x00000002)
FLAG_REPORTING_DESTINATION_SELLER
public static final int FLAG_REPORTING_DESTINATION_SELLER
常數值:1 (0x00000001)
公用方法
getAdSelectionId
public long getAdSelectionId ()
傳回 adSelectionId,亦即廣告選擇程序的主要 ID。
傳回 | |
---|---|
long |
getData
public String getData ()
傳回廣告事件資料。
廣告選擇後,呼叫端會產生這項資料。來電者可以接著呼叫 AdSelectionManager.reportEvent(ReportEventRequest, Executor, OutcomeReceiver)
。這項資料會透過 POST 要求附加至 registerAdBeacon
中註冊的 reportingUri
。
UTF-8
格式的 String#getBytes()
大小應小於 64 KB。
傳回 | |
---|---|
String |
此值不能為 null 。 |
getInputEvent
public InputEvent getInputEvent ()
傳回與使用者互動相關聯的輸入事件。
這個欄位可以是 null
(代表 view 事件),或包含 InputEvent
物件,代表 click 事件。
傳回 | |
---|---|
InputEvent |
getKey
public String getKey ()
傳回事件鍵,也就是要回報的廣告事件類型。
這個欄位會用來擷取與 eventKey
相關聯的 reportingUri
(廣告選擇程序結束後,interactionReportingUri 已於 registerAdBeacon
註冊)。
這個欄位必須與 registerAdBeacon
中註冊的 eventKey
完全相符。如需 registerAdBeacon
的具體詳細資料,請參閱 AdSelectionManager#reportImpression
的說明文件
使用 String#getBytes()
檢查其位元組陣列時,採用 UTF-8
格式的事件鍵不得超過 40 個位元組。凡是超過這項限制的鍵,都不會在 registerAdBeacon
呼叫期間註冊。
傳回 | |
---|---|
String |
此值不能為 null 。 |
getReportingDestinations
public int getReportingDestinations ()
傳回要回報到哪個報表目的地的位元欄位 (買家、賣家或兩者)。
如要建立這個位元欄位,請在每個要獲得回報的 reportingDestination
之間置入 |
位元運算子。舉例來說,如果只要向買家回報,請將 reportingDestinations 欄位設為 FLAG_REPORTING_DESTINATION_BUYER
。如果只要向賣家回報,請將 reportingDestinations 欄位設為 FLAG_REPORTING_DESTINATION_SELLER
。如要同時向買家和賣家回報,請將 reportingDestinations 欄位設為 FLAG_REPORTING_DESTINATION_BUYER
| FLAG_REPORTING_DESTINATION_SELLER
傳回 | |
---|---|
int |
值可以是 0 或 FLAG_REPORTING_DESTINATION_SELLER 的組合,以及 FLAG_REPORTING_DESTINATION_BUYER |