geniee_sdk_flutter 0.0.2 copy "geniee_sdk_flutter: ^0.0.2" to clipboard
geniee_sdk_flutter: ^0.0.2 copied to clipboard

A Flutter plugin for integrating the Geniee SDK, providing cross-platform ad display and mediation support for Android and iOS. Supporting banner, interstitial (full-screen), rewarded

Geniee SDK Flutter Plugin #

The geniee_sdk_flutter plugin brings the power of the Geniee SDK to your Flutter applications, enabling seamless integration of advertising and mediation solutions across both Android and iOS platforms. With support for multiple ad networks through mediation adapters, this plugin helps developers maximize monetization opportunities.

Features #

  • Ad Integration: Display ads effortlessly using the Geniee SDK.
  • Mediation Support: Compatible with leading ad networks via mediation adapters: Pangle, AppLovin, Google Ad Manager, Vungle, Unity Ads, Maio.
  • Cross-Platform: Fully functional on both Android and iOS.

Getting Started #

This plugin is a Flutter plug-in package, providing platform-specific implementations for Android and iOS.

Prerequisites #

  • Flutter SDK (see Flutter installation guide).
  • Android: Android Studio with SDK 21 or later.
  • iOS: Xcode 15.0 or later.
  • Minimum deployment targets: Android API 21 (5.0 Lollipop), iOS 12.0.

Installation #

  1. Add the dependency
    Add this to your pubspec.yaml:

    dependencies:
    geniee_sdk_flutter: ^0.0.2
    

    Then run: flutter pub get.

  2. Android Setup
    In android/app/build.gradle, ensure minSdkVersion is 21 or higher:

android { 
	defaultConfig { 
		minSdkVersion 21
	} 
}

Dependencies are managed via Gradle.

  1. iOS Setup
    Open ios/Runner.xcworkspace in Xcode, set deployment target to iOS 12.0+. Then, in ios/, run: pod install.

  2. Configure Permissions (if required)

  • Android: Add to android/app/src/main/AndroidManifest.xml:
<meta-data
	android:name="com.google.android.gms.ads.APPLICATION_ID"
	android:value="YOUR_GOOGLE_AD_MANAGER_APP_ID"/>

  • iOS: Add to ios/Runner/Info.plist (e.g., for Google Ad Manager):
<key>GADApplicationIdentifier</key> 
<string>YOUR_GOOGLE_AD_MANAGER_APP_ID</string> <key>NSUserTrackingUsageDescription</key> 
<string>This identifier will be used to deliver personalized ads to you.</string> 

Check each ad network’s docs for specifics.

Usage Here’s a basic example of initializing the Geniee SDK:


import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:geniee_sdk_flutter/geniee_sdk_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _interstitialAdStatus = 'Not Loaded';
  String _rewardedVideoAdStatus = 'Not Loaded';

  String bannerZoneId =
      defaultTargetPlatform == TargetPlatform.android
          ? "<BANNER_ANDROID_ZONE_ID>"
          : "<BANNER_IOS_ZONE_ID>";
  String interstitialZoneId =
      defaultTargetPlatform == TargetPlatform.android
          ? "<INTERSTITIAL_ANDROID_ZONE_ID>"
          : "<INTERSTITIAL_IOS_ZONE_ID>";
  String rewardZoneId =
      defaultTargetPlatform == TargetPlatform.android
          ? "<REWARD_ANDROID_ZONE_ID>"
          : "<REWARD_IOS_ZONE_ID>";

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        resizeToAvoidBottomInset: false,
        appBar: AppBar(
          title: const Text(
            'Geniee SDK Flutter Demo',
            style: const TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
          ),
          centerTitle: true,
        ),
        body: Padding(
          padding: const EdgeInsets.only(left: 16.0, right: 16.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Card(
                elevation: 4,
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    children: [
                      Text(
                        'Banner Ad',
                        style: const TextStyle(
                          fontSize: 16,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      const SizedBox(height: 16, width: double.infinity),
                      Container(
                        width: 320.0,
                        height: 50.0,
                        decoration: BoxDecoration(
                          border: Border.all(color: Colors.black, width: 1.0),
                        ),

                        child: GenieeBannerAd(
                          appId: bannerZoneId,
                          width: 320.0,
                          height: 50.0,
                          onAdReceived: () => print("Banner Ad: onAdReceived"),
                          onAdFailed:
                              (error) =>
                                  print('Banner Ad: onAdFailed - $error'),
                          onAdHidden: () => print('Banner Ad: onAdHidden'),
                          onStartExternalBrowser:
                              () => print('Banner Ad: onStartExternalBrowser'),
                        ),
                      ),
                    ],
                  ),
                ),
              ),

              const SizedBox(height: 8),
              Card(
                elevation: 4,
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    children: [
                      Text(
                        'Interstitial Ad Status: $_interstitialAdStatus',
                        style: const TextStyle(
                          fontSize: 16,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      const SizedBox(height: 16, width: double.infinity),

                      SizedBox(
                        width: double.infinity,
                        child: ElevatedButton(
                          onPressed: () async {
                            setState(() {
                              _interstitialAdStatus = 'Loading...';
                            });
                            GenieeInterstitialAd.loadAd(
                              zoneId: interstitialZoneId,
                              onAdReceived: () {
                                print('Interstitial ad loaded successfully');
                                setState(() {
                                  _interstitialAdStatus = 'Ad loaded';
                                });
                              },
                              onAdFailed: (error) {
                                print('Failed to load interstitial ad: $error');
                                setState(() {
                                  _interstitialAdStatus = 'Ad failed: $error';
                                });
                              },
                              onAdShown: () {
                                print('Interstitial ad shown');
                                setState(() {
                                  _interstitialAdStatus = 'Ad shown';
                                });
                              },
                              onAdClicked: () {
                                print('Interstitial ad clicked');
                                setState(() {
                                  _interstitialAdStatus = 'Ad clicked';
                                });
                              },
                              onAdClosed: () {
                                print('Interstitial ad dismissed');
                                setState(() {
                                  _interstitialAdStatus = 'Ad closed';
                                });
                              },
                            );
                          },
                          child: const Text(
                            'Load Interstitial',
                            style: TextStyle(
                              fontSize: 16,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                        ),
                      ),
                      SizedBox(
                        width: double.infinity,
                        child: ElevatedButton(
                          onPressed: () async {
                            if (await GenieeInterstitialAd.canShowAd()) {
                              await GenieeInterstitialAd.showAd();
                            } else {
                              print('Interstitial Ad Not Ready');
                            }
                          },
                          child: const Text(
                            'Show Interstitial',
                            style: TextStyle(
                              fontSize: 16,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              const SizedBox(height: 8),
              Card(
                elevation: 4,
                child: Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: Column(
                    children: [
                      Text(
                        'Rewarded Video Status: $_rewardedVideoAdStatus',
                        style: const TextStyle(
                          fontSize: 16,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      const SizedBox(height: 16, width: double.infinity),

                      SizedBox(
                        width: double.infinity,
                        child: ElevatedButton(
                          onPressed: () async {
                            setState(() {
                              _rewardedVideoAdStatus = 'Loading...';
                            });
                            GenieeRewardedVideoAd.loadAd(
                              zoneId: rewardZoneId,
                              useRTB: false,
                              onAdLoaded: () {
                                setState(() {
                                  _rewardedVideoAdStatus = 'Ad loaded';
                                });
                              },
                              onAdFailedToLoad: (error) {
                                setState(() {
                                  _rewardedVideoAdStatus = 'Ad failed: $error}';
                                });
                              },
                              onAdDismissed: () {
                                setState(() {
                                  _rewardedVideoAdStatus = 'Ad closed';
                                });
                              },
                              onAdStarted: () {
                                setState(() {
                                  _rewardedVideoAdStatus = 'Ad started';
                                });
                              },
                              onAdRewarded: (rewardItem) {
                                setState(() {
                                  _rewardedVideoAdStatus =
                                      'Ad rewarded: ${rewardItem.type} - ${rewardItem.amount}';
                                });
                              },
                            );
                          },
                          child: const Text(
                            'Load Rewarded Video',
                            style: TextStyle(
                              fontSize: 16,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                        ),
                      ),

                      SizedBox(
                        width: double.infinity,
                        child: ElevatedButton(
                          onPressed: () async {
                            if (await GenieeRewardedVideoAd.canShowAd()) {
                              await GenieeRewardedVideoAd.showAd();
                              print('Rewarded Video Ad Shown');
                            } else {
                              print('Rewarded Video Ad Not Ready');
                            }
                          },
                          child: const Text(
                            'Show Rewarded Video',
                            style: TextStyle(
                              fontSize: 16,
                              fontWeight: FontWeight.w500,
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}


Example Project #

Run the example in example/:

cd example
flutter pub get
flutter run
0
likes
140
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for integrating the Geniee SDK, providing cross-platform ad display and mediation support for Android and iOS. Supporting banner, interstitial (full-screen), rewarded

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on geniee_sdk_flutter

Packages that implement geniee_sdk_flutter