Skip to main content

unified_ads_facebook 1.1.0 copy "unified_ads_facebook: ^1.1.0" to clipboard
unified_ads_facebook: ^1.1.0 copied to clipboard

Facebook Audience Network (Meta) adapter for unified_ads: banner, interstitial and rewarded. Links only the Audience Network SDK; production fill needs bidding.

example/README.md

unified_ads_facebook example #

Add the core package and this adapter. Only the Facebook Audience Network SDK is linked into your app.

dependencies:
  unified_ads: ^1.1.0
  unified_ads_facebook: ^1.1.0

The adapter registers itself through Flutter's plugin registrant, so you don't need to import it.

import 'package:flutter/widgets.dart';
import 'package:unified_ads/unified_ads.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await UnifiedAds.init(AdConfig(
    testMode: true, // never ship with test mode on
    networks: {
      AdNetwork.facebook: NetworkConfig(
        // No app ID in code. Test placements: IMG_16_9_APP_INSTALL#<placement id>
        bannerAdUnitId: 'your-banner-id',
        interstitialAdUnitId: 'your-interstitial-id',
        rewardedAdUnitId: 'your-rewarded-id',
      ),
    },
  ));

  final rewarded = RewardedAd(
    onEarnedReward: (ad, reward) =>
        debugPrint('${reward.amount} ${reward.type} from ${ad.servedBy}'),
  );
  if ((await rewarded.load()).isSuccess) await rewarded.show();
}

Banner: UnifiedBannerWidget(ad: BannerAd(size: const BannerSize.adaptiveAnchored()), anchored: true).

Platform setup (manifest, Info.plist, SKAdNetwork IDs): doc/setup/facebook.md. For a full app with every network, a settings screen and a live event log, see the example app.

1
likes
160
points
492
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Facebook Audience Network (Meta) adapter for unified_ads: banner, interstitial and rewarded. Links only the Audience Network SDK; production fill needs bidding.

Repository (GitHub)
View/report issues
Contributing

Topics

#ads #facebook #audience-network #monetization

License

MIT (license)

Dependencies

flutter, meta, unified_ads_platform_interface

More

Packages that depend on unified_ads_facebook

Packages that implement unified_ads_facebook