Methods
| Method | Behavior |
|---|
create(context, platformId, baseUrl) | One client per installation. Persists installationId in SharedPreferences; reads packageName from Context. |
|---|
requestAd(AdRequest): MobileAd? | suspend. Fetch and cache; null on no-fill. HTTP/network errors: SidekickException/IOException. |
|---|
interact(ad, action): MobileAd | suspend. Pass the original action token. The scene retains deliveryId and expiresAtMillis. |
|---|
trackView(ad): Boolean | suspend. For custom UI after a visible view. Test ads and local repeats return false. |
|---|
close() | Permanently closes the client and cancels its tasks. |
|---|
SidekickAdView.load(client, request) | Fetch and render. Errors/no-fill hide only the ad. |
|---|
SidekickAdView.bind(client, ad) | Render an existing response with automatic /seen. |
|---|
appearance / screenActive / onError | Appearance, screen activity, error callback. |
|---|
clear() / release() | Unmount the card / permanently dispose the View. Do not reuse a released View. |
|---|
AdRequest
| Field | Type | Constraint |
|---|
| requestId | String | 1-128; A-Z a-z 0-9 _ . : - |
|---|
| placement | String | chat; 1-64; A-Z a-z 0-9 _ - |
|---|
| languageCode | String | 1-32; defaults to Locale language |
|---|
| acceptedFormats | Set<AdFormat> | TEXT, IMAGE, RESPONSE, CARD, CONSENT, QUIZ |
|---|
| context | AdContext? | question ≤4096; answer ≤16384 |
|---|
| test / testFormat | Boolean / AdFormat? | false / null. Test platforms always return demo ads. |
|---|
Cache: 64 entries and up to 64 concurrent requests. No-fill: 30 seconds; ads: until expiresAtMillis. Reusing requestId with different content is rejected.
MobileAd · AdAppearance