{"id":19742444,"url":"https://github.com/dreamsoftin/facebook_audience_network","last_synced_at":"2025-10-27T09:03:51.437Z","repository":{"id":38361470,"uuid":"183733604","full_name":"dreamsoftin/facebook_audience_network","owner":"dreamsoftin","description":"Flutter Facebook Audience Network","archived":false,"fork":false,"pushed_at":"2024-08-09T09:35:41.000Z","size":22202,"stargazers_count":159,"open_issues_count":76,"forks_count":91,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T10:07:15.161Z","etag":null,"topics":["ads","ads-sdk","dart","facebook","facebook-audience-network","flutter","flutter-plugin","flutter-widget"],"latest_commit_sha":null,"homepage":"https://pub.dartlang.org/packages/facebook_audience_network/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dreamsoftin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-27T05:46:07.000Z","updated_at":"2025-03-03T17:00:41.000Z","dependencies_parsed_at":"2024-11-12T01:32:16.716Z","dependency_job_id":"47766638-629b-4cc2-8f31-f51d297e4aab","html_url":"https://github.com/dreamsoftin/facebook_audience_network","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamsoftin%2Ffacebook_audience_network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamsoftin%2Ffacebook_audience_network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamsoftin%2Ffacebook_audience_network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamsoftin%2Ffacebook_audience_network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dreamsoftin","download_url":"https://codeload.github.com/dreamsoftin/facebook_audience_network/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ads","ads-sdk","dart","facebook","facebook-audience-network","flutter","flutter-plugin","flutter-widget"],"created_at":"2024-11-12T01:31:37.960Z","updated_at":"2025-10-27T09:03:51.370Z","avatar_url":"https://github.com/dreamsoftin.png","language":"Swift","funding_links":[],"categories":["组件","Uncategorized","Monetization [🔝](#readme)","Components"],"sub_categories":["赚钱","推广和盈利","Uncategorized","Monetization"],"readme":"# facebook_audience_network\n![Pub](https://img.shields.io/pub/v/facebook_audience_network.svg) ![GitHub](https://img.shields.io/github/license/dreamsoftin/facebook_audience_network.svg)\u003ca href=\"https://github.com/Solido/awesome-flutter\"\u003e\n   \u003cimg alt=\"Awesome Flutter\" src=\"https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true\u0026style=flat-square\" /\u003e\n\u003c/a\u003e\n\n[Facebook Audience Network](https://developers.facebook.com/docs/audience-network) plugin for Flutter applications (Android \u0026 iOS).\n\n| Banner Ad | Native Banner Ad | Native Ad |\n| - | - | - |\n| ![Banner Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/banner.gif \"Banner Ad\") | ![Native Banner Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/native_banner.gif \"Native Banner Ad\") | ![Native Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/native.gif \"Native Ad\") |\n\n| Interstitial Ad | Rewarded Video Ad |\n| - | - |\n| ![Interstitial Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/interstitial.gif \"Interstitial Ad\") | ![Rewarded Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/rewarded.gif \"Rewarded Video Ad\") |\n\n---\n## Getting Started\n\n### 1. Initialization:\n\nFor testing purposes you need to obtain the hashed ID of your testing device. To obtain the hashed ID: \n\n1. Call `FacebookAudienceNetwork.init()` during app initialization.\n2. Place the `FacebookBannerAd` widget in your app.\n3. Run the app.\n\nThe hased id will be in printed to the logcat. Paste that onto the `testingId` parameter.\n\n```dart\nFacebookAudienceNetwork.init(\n  testingId: \"37b1da9d-b48c-4103-a393-2e095e734bd6\", //optional\n  iOSAdvertiserTrackingEnabled: true //default false\n);\n```\n##### IOS Setup\nIn Pod file, set the IOS deployment target version to 9.0\n\n*IN iOS, Banner, Interstital and Native Ads are supported* \n\n---\n### 2. Show Banner Ad:\n\n```dart\nContainer(\n  alignment: Alignment(0.5, 1),\n  child: FacebookBannerAd(\n    placementId: Platform.isAndroid ? \"YOUR_ANDROID_PLACEMENT_ID\" : \"YOUR_IOS_PLACEMENT_ID\",\n    bannerSize: BannerSize.STANDARD,\n    listener: (result, value) {\n      switch (result) {\n        case BannerAdResult.ERROR:\n          print(\"Error: $value\");\n          break;\n        case BannerAdResult.LOADED:\n          print(\"Loaded: $value\");\n          break;\n        case BannerAdResult.CLICKED:\n          print(\"Clicked: $value\");\n          break;\n        case BannerAdResult.LOGGING_IMPRESSION:\n          print(\"Logging Impression: $value\");\n          break;\n      }\n    },\n  ),\n)\n```\n---\n### 3. Show Interstitial Ad:\n\n```dart\nFacebookInterstitialAd.loadInterstitialAd(\n  placementId: \"YOUR_PLACEMENT_ID\",\n  listener: (result, value) {\n    if (result == InterstitialAdResult.LOADED)\n      FacebookInterstitialAd.showInterstitialAd(delay: 5000);\n  },\n);\n```\n---\n### 4. Show Rewarded Video Ad:\n(Android Only)\n\n```dart\nFacebookRewardedVideoAd.loadRewardedVideoAd(\n  placementId: \"YOUR_PLACEMENT_ID\",\n  listener: (result, value) {\n    if(result == RewardedVideoResult.LOADED)\n      FacebookRewardedVideoAd.showRewardedVideoAd();\n    if(result == RewardedVideoResult.VIDEO_COMPLETE)\n      print(\"Video completed\");\n  },\n);\n```\n---\n### 5. Show Native Ad:\n- NativeAdType NATIVE_AD_HORIZONTAL \u0026 NATIVE_AD_VERTICAL ad types are supported only in iOS. In Android use NATIVE_AD.\n```dart\nFacebookNativeAd(\n  placementId: \"YOUR_PLACEMENT_ID\",\n  adType: NativeAdType.NATIVE_AD,\n  width: double.infinity,\n  height: 300,\n  backgroundColor: Colors.blue,\n  titleColor: Colors.white,\n  descriptionColor: Colors.white,\n  buttonColor: Colors.deepPurple,\n  buttonTitleColor: Colors.white,\n  buttonBorderColor: Colors.white,\n  keepAlive: true, //set true if you do not want adview to refresh on widget rebuild\n  keepExpandedWhileLoading: false, // set false if you want to collapse the native ad view when the ad is loading \n  expandAnimationDuraion: 300, //in milliseconds. Expands the adview with animation when ad is loaded\n  listener: (result, value) {\n    print(\"Native Ad: $result --\u003e $value\");\n  },\n),\n```\n---\n### 6. Show Native Banner Ad:\nUse `NativeBannerAdSize` to choose the height for Native banner ads. `height` property is ignored for native banner ads.\n\n```dart\nFacebookNativeAd(\n  placementId: \"YOUR_PLACEMENT_ID\",\n  adType: NativeAdType.NATIVE_BANNER_AD,\n  bannerAdSize: NativeBannerAdSize.HEIGHT_100,\n  width: double.infinity,\n  backgroundColor: Colors.blue,\n  titleColor: Colors.white,\n  descriptionColor: Colors.white,\n  buttonColor: Colors.deepPurple,\n  buttonTitleColor: Colors.white,\n  buttonBorderColor: Colors.white,\n  listener: (result, value) {\n    print(\"Native Ad: $result --\u003e $value\");\n  },\n),\n```\n---\n**Check out the [example](https://github.com/dreamsoftin/facebook_audience_network/tree/master/example) for complete implementation.**\n\niOS wrapper code contribution by **lolqplay team from birdgang**\n\n### Note: Instream video ad has been removed by Facebook. Read more [here](https://www.facebook.com/business/help/645132129564436?id=211412110064838)\n\n## Future Work\nImplement Rewarded video for iOS platform.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamsoftin%2Ffacebook_audience_network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdreamsoftin%2Ffacebook_audience_network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamsoftin%2Ffacebook_audience_network/lists"}