@quenary/capacitor-yandex-ads
v1.1.0
Published
Yandex Ads plugin for capacitor apps
Downloads
113
Maintainers
Readme
@quenary/capacitor-yandex-ads
Capacitor plugin for Yandex Mobile Ads SDK on Android and iOS. Supports sticky banners, interstitials, rewarded video, app open ads, native ads, and ad feeds.
Web is not implemented.
Compatibility
| Plugin | Capacitor | Yandex Ads Android | Yandex Ads iOS | | --- | --- | --- | --- | | 1.0.0 | 8.x | 8.2.0 | 8.3.0 |
Install
npm install @quenary/capacitor-yandex-ads
npx cap syncOn iOS, add SKAdNetwork identifiers to the app Info.plist. If you use Swift Package Manager, set Other Linker Flags to include -ObjC.
Usage
Call setUserConsent on every launch before initialize.
import { YandexAds } from '@quenary/capacitor-yandex-ads';
await YandexAds.setUserConsent({ value: true });
await YandexAds.initialize();
await YandexAds.loadBanner({
adUnitId: 'demo-banner-yandex',
position: 'top',
overlap: false,
});
await YandexAds.showBanner();
await YandexAds.loadInterstitial({ adUnitId: 'demo-interstitial-yandex' });
await YandexAds.showInterstitial();
const rewardedHandle = await YandexAds.addListener('rewardedVideoAdRewarded', (reward) => {
// reward.type, reward.amount
});
await YandexAds.loadRewardedVideo({ adUnitId: 'demo-rewarded-yandex' });
await YandexAds.showRewardedVideo();
await rewardedHandle.remove();
await YandexAds.loadAppOpen({ adUnitId: 'demo-appopenad-yandex' });
await YandexAds.showAppOpen();
await YandexAds.loadNative({
adUnitId: 'demo-native-content-yandex',
position: 'bottom',
overlap: false,
});
await YandexAds.showNative();
await YandexAds.loadFeed({ adUnitId: 'demo-feed-yandex' });
await YandexAds.showFeed();The plugin does not show app open ads automatically on resume. Call showAppOpen from the host app when appropriate.
Demo ad unit IDs: demo-banner-yandex, demo-interstitial-yandex, demo-rewarded-yandex, demo-appopenad-yandex, demo-native-content-yandex, demo-feed-yandex.
Full API reference: docs/DOCGEN.md.
Acknowledgments
Development used cordova-plugin-yandex-ads as a reference. Thanks to maximnara for that work.
