🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsKB5129194 Windows 11 26H1 Out of Band Update - Deskmodder.de(14.09.2026 um 19:25 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsKB5129194 Windows 11 26H1 Out of Band Update - Deskmodder.de(14.09.2026 um 19:25 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 4 Min Lesezeit
0

A New Advertising API, Built From The Ground Up

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

.








One API, every format



The public API lives in com.codename1.ads. AdManager is the entry point, and there is a type per format: InterstitialAd, RewardedAd, RewardedInterstitialAd, AppOpenAd, BannerAd, and NativeAdLoader. Consent is handled by AdConsent (UMP plus iOS ATT), and AdConfig, AdRequest, and AdListener round out the surface. The whole thing is event-driven and every callback is marshaled onto the EDT, so you never touch ad SDK threading.



A rewarded ad, the format people most often ask about, reads like this:




CODE
AdConfig cfg = new AdConfig().testMode(true);
AdManager.initialize(cfg, ok -> {
if (!ok) {
return;
}
RewardedAd ad = new RewardedAd("your-rewarded-ad-unit-id");
ad.setAdListener(new AdListener() {
public void onLoaded() {
ad.show(reward ->
grantCoins(reward.getType(), reward.getAmount()));
}
});
ad.load();
});






Consent is a first-class step rather than an afterthought:




CODE
AdConsent.requestConsent(status -> {
if (AdConsent.canRequestAds()) {
loadAds();
}
});









Pluggable by design



The provider side is an SPI (Service Provider Interface) in com.codename1.ads.spi: a network-agnostic AdProvider plus session interfaces. Discovery is zero-wiring. AdManager resolves the provider through a single call to install(), so adding an ad cn1lib to your project auto-registers it with no setup code. AdMob, AppLovin MAX, Unity LevelPlay, or your own mediation layer can be swapped without touching app code.



A few things only the core can do, and they are wired in directly:




CODE
// Show an interstitial on form transitions, no more often than every two minutes
AdManager.bindInterstitialOnTransition(interstitial, 120000);

// Show an app-open ad when the app returns to the foreground
AdManager.enableAppOpenAds(appOpenAd);






Banners are peer-backed components, so they sit in your layout like any other component.






AdMob as the reference provider



The reference provider is a real, modern AdMob integration shipped as maven/cn1-admob, modeled on the ML Kit cn1libs. It targets Google Mobile Ads v24 and up on Android, the current GAD* APIs with UMP and ATT on iOS, and AdMob mediation works transparently behind it. You will need to add these to your build hints:




CODE
android.xapplication=<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-XXXXXXXX~YYYYYYYY"/>
ios.plistInject=<key>GADApplicationIdentifier</key><string>ca-app-pub-XXXXXXXX~YYYYYYYY</string>






Those hints set the Android APPLICATION_ID manifest meta-data and the iOS GADApplicationIdentifier. For iOS you should also declare your SKAdNetworkItems and an NSUserTrackingUsageDescription (the ATT prompt copy) the same way.






Debugging Ads



The simulator ships a placeholder provider so you can exercise every format and the consent flow, without a device. The AdsSample in the samples repo runs every format against the simulator placeholder if you want to see the flows before you wire up a real account.



A reminder that applies to any ad integration: if you do server-side reward verification, the verification has to happen on your server. Do not trust a reward granted purely on the client, and do not embed any server secret in the app.



The previous deep dive covered has the full index. Tomorrow's post, the last of the run, is about background work, push topics, and richer notifications.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
2 Quellen
Microsoft Releases Emergency Windows 11 Updates to Address Security Vulnerabilities
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Burn Out, Or Fade Away
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten A New Advertising API, Built From The Ground Up

Thematisch verwandte Begriffe: Advertising, Built, From, Ground · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...