This repository contains a Flutter integration for Google Ads Mobile. It provides a seamless way to integrate Google Ads into your Flutter mobile applications, allowing you to monetize your apps using Google's advertising platform.
- Easy integration of Google Ads in Flutter applications.
- Support for various ad formats including banner, interstitial, and rewarded ads.
- Customizable ad placements.
- Built-in support for ad lifecycle management.
- Comprehensive documentation and examples for quick setup and usage.
Follow the instructions below to set up and use this package in your Flutter project.
- Flutter SDK 2.0 or higher
- Dart 2.12 or higher
- Google Ads account
- Ensure your app is registered in the Google AdMob platform
Add the package to your pubspec.yaml
file:
dependencies:
googleads_mobile_flutter: ^1.0.0
Then, run the following command to fetch the package:
flutter pub get
-
Configure AdMob in your Flutter Project:
Add your AdMob app ID to your
AndroidManifest.xml
andInfo.plist
files for Android and iOS, respectively. -
Initialize the Google Ads SDK:
Call the initialization method in your app's
main
function:void main() async { WidgetsFlutterBinding.ensureInitialized(); await GoogleAdsMobileFlutter.initialize(); runApp(MyApp()); }
-
Display Ads:
Use the provided widgets or APIs to display ads in your app. For example:
BannerAd( adUnitId: 'your-ad-unit-id', size: AdSize.banner, )
Refer to the detailed documentation in the docs
folder for additional features and examples.
We welcome contributions to enhance this project. To contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push them to your fork.
- Submit a pull request with a detailed description of your changes.
This project uses GitHub Actions for continuous integration. The current build status is displayed above. To run tests locally, use the following command:
flutter test
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or support, please reach out to the project maintainers through GitHub Issues.
Happy coding! 🚀