dktech_admob 1.0.5 copy "dktech_admob: ^1.0.5" to clipboard
dktech_admob: ^1.0.5 copied to clipboard

dktech_admob

Example #

https://github.com/Namdh1212/flutter-admob/tree/devlopment

configuration Admoblib #

  void initState() {
     AdmodUtils.configurationAdmob(isDebug: true, isShowAds: true);
  }

AppOpenAd #

  void initState() {
     AdmodUtils.loadAppOpenAd();
}

Interstitial #

       AdmodUtils.loadAndShowAdInterstitialWithCallback(
                    Androidid:
                    "ca-app-pub-3940256099942544/1033173712",
                    IOSid: "ca-app-pub-3940256099942544/4411468910",
                    enableLoadingDialog: true,
                    onAdClosed: () {
                    Fluttertoast.showToast(msg: "onAdClose");
                    },
                    onAdFail: () {
                    Fluttertoast.showToast(msg: "onAdFail");
                    });

Reward #

          AdmodUtils.loadAndShowAdRewardWithCallback(
                                    Androidid:
                                    "ca-app-pub-3940256099942544/1033173712",
                                    IOSid: "ca-app-pub-3940256099942544/4411468910",
                                    enableLoadingDialog: true,
                                    onAdClosed: () {
                                    Fluttertoast.showToast(msg: "onAdClose");
                                    // if(onUserEarned) ... else ...
                                    },
                                    onUserEarned: () {
                                    Fluttertoast.showToast(msg: "onUserEarned");
                                    // onUserEarned = true
                                    },
                                    onAdFail: () {
                                    Fluttertoast.showToast(msg: "onAdFail");
                                    // if(onUserEarned) ... else ...
                                    });

 void initState() {
                AdmodUtils.loadAdBanner(
                          Androidid: 'ca-app-pub-3940256099942544/6300978111',
                            IOSid: 'ca-app-pub-3940256099942544/2934735716',
                            onAdLoaded: () {
                              setState(() {
                                Fluttertoast.showToast(msg: "onAdLoaded "
                                    "Banner");
                              });
                            },
                            onAdFailed: () {
                              setState(() {
                                Fluttertoast.showToast(msg: "onAdFailed Banner");
                                //gone view
                              });
                            },
                            context: context);
}

add to view

    AdmodUtils().getAdWidget()

Native #

    AdmodUtils.loadNativeAd(
        Androidid: "ca-app-pub-3940256099942544/2247696110",
        IOSid: "ca-app-pub-3940256099942544/2247696110",
        onAdLoaded: () {
          setState(() {
            Fluttertoast.showToast(msg: "onAdLoaded native");
            AdmodUtils.isNativeAdLoaded = true;
          });
        },
        onAdFailed: () {
          setState(() {
            Fluttertoast.showToast(msg: "onAdFailed native");

          });
        });

add to view

           AdmodUtils.isNativeAdLoaded ?  Container(
                    alignment: Alignment.center,
                    child: AdWidget(ad: AdmodUtils.adNative),
                    width: MediaQuery.of(context).size.width,
                    height: 500,
                    ) : Container()