Dependency
Add the AdMob wrapper artifact
dependencies {
implementation("com.yuktinai:amos-sdk-admob:1.0.16")
}
Full SDK Guide
Use this page after the quick setup page. Pick the app stack and serving model, then follow the detailed steps and copy the matching examples.
Choose an integration
Dependency
dependencies {
implementation("com.yuktinai:amos-sdk-admob:1.0.16")
}
Groups
object PublisherAdMobConfigProvider {
fun build() = AdMobConfig(
interstitialGroups = mapOf(
AdMobConfig.DEFAULT_GROUP_REF to AdMobGroupConfig(
unitIds = listOf("ca-app-pub-xxx/111"),
preloadOnInit = true
),
"interstitial_level_end" to AdMobGroupConfig(
unitIds = listOf("ca-app-pub-xxx/112"),
allowFallbackToDefault = true
)
),
rewardedGroups = mapOf(
"rewarded_bonus_claim" to AdMobGroupConfig(
unitIds = listOf("ca-app-pub-xxx/222"),
preloadOnInit = true,
allowFallbackToDefault = true
)
),
bannerGroups = mapOf(
"banner_content" to AdMobGroupConfig(
unitIds = listOf("ca-app-pub-xxx/333")
)
),
nativeGroups = mapOf(
"native_feed_card" to AdMobGroupConfig(
unitIds = listOf("ca-app-pub-xxx/444")
)
),
appOpenGroups = mapOf(
"app_open_cold_start" to AdMobGroupConfig(
unitIds = listOf("ca-app-pub-xxx/555"),
preloadOnInit = true
)
)
)
}
Initialize
AmosAdMob.configure(PublisherAdMobConfigProvider.build())
Monetization.init(
context = applicationContext,
apiKey = "YOUR_API_KEY",
appId = "YOUR_APP_ID",
userId = "publisher-user-123"
) {
AmosAdMob.initialize(this)
}
Show Ads
AmosAdMob.showRewarded(
activity = this,
groupRef = "rewarded_bonus_claim",
onRewardEarned = { grantCreditToUser() },
onFailed = { error -> Log.w("AMOS", "Rewarded failed: $error") }
)
AmosAdMob.showInterstitial(
activity = this,
groupRef = "interstitial_level_end"
)
AmosAdMob.createBannerView(
context = this,
groupRef = "banner_content",
container = bannerContainer
)
Dependency
dependencies {
implementation("com.yuktinai:amos-sdk:1.0.16")
implementation("com.google.android.gms:play-services-ads:25.4.0")
}
Session
Monetization.init(
context = applicationContext,
apiKey = "YOUR_API_KEY",
appId = "YOUR_APP_ID",
userId = "publisher-user-123"
) {
Monetization.trackEventIfAllowed("first_open")
}
Manual Load
val request = Monetization.preloadAdMobInterstitial("interstitial_level_end")
if (request != null) {
InterstitialAd.load(
context,
request.unitId,
AdRequest.Builder().build(),
object : InterstitialAdLoadCallback() {
override fun onAdLoaded(ad: InterstitialAd) {
Monetization.markAdMobInterstitialLoaded(request.groupRef, ad)
}
override fun onAdFailedToLoad(error: LoadAdError) {
Monetization.markAdMobInterstitialLoadFailed(request.groupRef)
}
}
)
}
Telemetry
Monetization.trackMetricsIfAllowed(
mapOf(
"platform" to "android",
"country" to "US",
"device_model" to Build.MODEL
)
)
Monetization.recordAdMobInterstitialShown("interstitial_level_end")
Monetization.recordAdMobRewardedShown("rewarded_bonus_claim")
Install
npm install @amos-sdk/react-native-admob@1.0.19
Provider
import { AmosProvider } from '@amos-sdk/react-native-admob';
const amosConfig = {
apiKey: 'YOUR_API_KEY',
appId: 'YOUR_APP_ID',
userId: 'publisher-user-123',
bootstrap: {
firstOpenEvent: 'first_open',
metrics: ['platform', 'country', 'install_source', 'device_model'],
installSourceFallback: 'other',
},
admob: {
interstitialGroups: {
default: { unitIds: ['ca-app-pub-xxx/111'] },
},
rewardedGroups: {
default: { unitIds: ['ca-app-pub-xxx/222'], preloadOnInit: true },
},
bannerGroups: {
default: { unitIds: ['ca-app-pub-xxx/333'] },
},
},
};
export function App() {
return (
<AmosProvider config={amosConfig}>
<RootNavigator />
</AmosProvider>
);
}
Usage
import { AmosBannerAd, useAmos } from '@amos-sdk/react-native-admob';
function RewardScreen() {
const amos = useAmos();
async function onRewardTap() {
const rewarded = await amos.showRewarded('default');
if (rewarded) {
await amos.trackEvent('rewarded_ad_complete');
grantCreditToUser();
}
}
return <AmosBannerAd groupRef="default" />;
}
Install
npm install @amos-sdk/react-native@2.0.12
Provider
import { AmosProvider } from '@amos-sdk/react-native';
const amosConfig = {
apiKey: 'YOUR_API_KEY',
appId: 'YOUR_APP_ID',
userId: 'publisher-user-123',
bootstrap: {
firstOpenEvent: 'first_open',
metrics: ['platform', 'country', 'install_source', 'device_model'],
},
};
export function App() {
return (
<AmosProvider config={amosConfig}>
<RootNavigator />
</AmosProvider>
);
}
Signals
const amos = useAmos();
await amos.trackEvent('image_selection');
await amos.trackEvent('ai_feature_completed');
await amos.trackMetric('platform', 'android');
await amos.trackMetric('device_model', 'sm_s908b');
Install
dependencies:
amos_flutter: ^1.0.0
amos_flutter_admob: ^1.0.0
Android manifest
<application ...>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
</application>
Initialize
final state = await AmosClient.instance.initialize(
const AmosConfiguration(
apiKey: String.fromEnvironment('AMOS_API_KEY'),
appId: 'YOUR_APP_ID',
externalUserId: 'stable-user-reference',
),
);
await AmosAdMob.instance.initialize();
Ads
final ads = state.decision.ads;
if (state.decision.provider == 'admob' && ads.interstitialEnabled) {
final load = await AmosAdMob.instance.preloadInterstitial();
if (load.loaded) await AmosAdMob.instance.showInterstitial();
}
if (ads.rewardedEnabled) {
await AmosAdMob.instance.preloadRewarded();
final result = await AmosAdMob.instance.showRewarded();
if (result.rewardEarned) grantReward();
}
// Widget tree:
return ads.bannerEnabled
? const AmosBannerAd()
: const SizedBox.shrink();
Install
dependencies:
amos_flutter: ^1.0.0
Session
final state = await AmosClient.instance.initialize(
const AmosConfiguration(
apiKey: String.fromEnvironment('AMOS_API_KEY'),
appId: 'YOUR_APP_ID',
externalUserId: 'stable-user-reference',
),
);
Signals and policy
await AmosClient.instance.trackEvent('purchase_completed');
await AmosClient.instance.trackMetric('purchase_value', 9.99);
final paywall = await AmosClient.instance
.getPaywallDecision('editor_export');
if (paywall.shouldShow) {
showYourPaywall();
await AmosClient.instance.recordPaywallShown('editor_export');
}
final config = await AmosClient.instance.getRemoteConfig();
Production checklist
Package links