Skip to content

Fix the broken README examples - #53

Merged
jrosendahl-opt merged 1 commit into
masterfrom
fix/readme-examples
Nov 4, 2026
Merged

jrosendahl-opt merged 1 commit into
masterfrom
fix/readme-examples

Conversation

@jrosendahl-opt

@jrosendahl-opt jrosendahl-opt commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Why

Several README examples didn't compile against the current SDK, and some prose described behaviour the SDK no longer has. Developers copying them hit errors straight away.

What Changed

  • README, code examples:
    • Identifiers and GAM sections used the removed OptableIdentifiers class; they now use OptableIdentifier (listOf(OptableIdentifier.Email(…)) / Arrays.asList(new OptableIdentifier.Email(…))).
    • Targeting examples read .audiences / getAudiences(), which don't exist; they now read gamTargetingKeywords.
    • Null checks on gamTargetingKeywords are removed: it's a non-null Map.
    • Java profile example matched OptableResult.Error<Unit>; profile returns OptableResult<OptableTargeting>.
    • Java targeting example was missing two semicolons.
    • Java examples used Guava's Lists.newArrayList; they now use Arrays.asList.
    • Consents example used req = "gdpr"; the parameter is reg.
  • README, prose:
    • The default user agent comes from WebSettings.getDefaultUserAgent(), not from a WebView's settings.userAgentString.
    • customUserAgent was called the "fifth parameter"; it's the eighth, and the examples pass it by name.
    • Email and phone are hashed with SHA-256, not "encrypted".

Several README examples didn't compile against the current SDK: they used
the removed OptableIdentifiers class, a non-existent `audiences` field,
`req` instead of `reg` in OptableConsents, the wrong result type for
profile() in Java, and missing semicolons. The Java examples also relied
on Guava's Lists.newArrayList.

Also describe how the default user agent is obtained
(WebSettings.getDefaultUserAgent), drop the "fifth parameter" wording for
customUserAgent, say email and phone are hashed rather than encrypted,
and remove null checks on gamTargetingKeywords, which is never null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jrosendahl-opt
jrosendahl-opt merged commit 8a8df6a into master Nov 4, 2026
3 checks passed
@jrosendahl-opt
jrosendahl-opt deleted the fix/readme-examples branch November 4, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants