admob_widgets

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

admob widgets

Admob Widgets #
A variety of widgets to use easily ad units of AdMob
Getting started #
Android #
Modify the AndroidManifest.xml adding the next
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
copied to clipboard
In application tag, add the next
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-{your application ID}"/>
copied to clipboard
Finally in the main add the next code
void main() async{
WidgetsFlutterBinding.ensureInitialized();
AdMobWidgets.instance(
androidBannerAdUnitId: "{Your banner ad unit Id}",
androidInterstitialAdUnitId: "Your intertitial ad unit Id"
);
await MobileAds.instance.initialize();
runApp(const MainApp());
}
copied to clipboard
Usage #
Banner Widget #
// Only call the widget
const BannerWidget();
copied to clipboard
Instertitial #
// Initialize the the class InterstitialUnit
final interstitialUnit = InterstitialUnit();
// Initialize InterstitialAd
InterstitialAd? _interstitialAd;

@override
void initState() {
super.initState();
// Load the ad
interstitialUnit.loadAd();
}

setState(() {
//Asign the class's intertitial to local interstitial
_interstitialAd = interstitialUnit.interstitialAd;
// check interstital is not null
if(_interstitialAd != null){
// show the interstitial
_interstitialAd!.show();
// reload the interstitial
interstitialUnit.loadAd();
}
});
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.