google_applovin_unity_ads 2.1.1 copy "google_applovin_unity_ads: ^2.1.1" to clipboard
google_applovin_unity_ads: ^2.1.1 copied to clipboard

outdated

Ads Implement

ADD IN PUBSPEC.YMAL #

dependencies:
  google_applovin_unity_ads:
  get:
  flutter_screenutil:

ADD IN ANDROID MANIFEST #

//PERMISSION 
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

<applicaton

<meta-data
    android:name="com.google.android.gms.ads.AD_MANAGER_APP"
    android:value="true" />


//FOR ANDROID SPLASH SCREEN
<meta-data
    android:name="io.flutter.embedding.android.SplashScreenDrawable"
    android:resource="@drawable/launch_background" />

</application>

ADD IN BUILD GRADEL #

    multiDexEnabled true
    targetSdkVersion 33

ADD IN VOID MAIN #

void main() {
      WidgetsFlutterBinding.ensureInitialized();
      MobileAds.instance.initialize();
      runApp(const MyApp());
}

INITIALISE ADS FIRST TIME #

      fetchAdsSettings(
      appVersionCode: 1,
      settingsUrl:"https://gitlab.com/bitcodings/iptv_channels/-/raw/main/test_ads.json",
      keyName: "com.bitlinks.arebic.iptv.m3ulist")
      .then((value) => {});

FOR OPEN AD #

        initOpenAds(onOpenAdLoaded: () => {showOpenAds()}),

FOR INTRA AD #

        showIntraAds(callback: () => {});

FOR REWARD AD #

        showRewardAds(callback: () => {});

FOR BANNER AD #

        MAX HEIGHT
        bottomNavigationBar:showBannerAds(size: AdSize.mediumRectangle);

        MEDIUM HEIGHT
        bottomNavigationBar:showBannerAds(size: AdSize.largeBanner);

        NORMAL HEIGHT
        bottomNavigationBar:showBannerAds(size: AdSize.banner);

FOR NATIVE AD #

ADD IN MAINACTIVITY.KT #

import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import com.btcpiyush.ads.google_applovin_unity_ads.CustomNativeAd
import com.btcpiyush.ads.google_applovin_unity_ads.GoogleApplovinUnityAdsPlugin

class MainActivity: FlutterActivity() {
  override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
    super.configureFlutterEngine(flutterEngine)
    val factory: CustomNativeAd =
        CustomNativeAd(
            getLayoutInflater()
        )
    GoogleApplovinUnityAdsPlugin.registerNativeAdFactory(flutterEngine, "nativeFactoryId", factory)
  }

  override fun cleanUpFlutterEngine(flutterEngine: FlutterEngine) {
    GoogleApplovinUnityAdsPlugin.unregisterNativeAdFactory(flutterEngine, "nativeFactoryId")
  }
}

LOAD NATIVE ADS #

        Widget native = Container(height: 0);

@override
void initState() {
  // TODO: implement initState
  super.initState();
  loadNativeAds(
      onAdLoadedCallback: () => {
        setState(() {
          native = showNativeAds(size: Size(double.infinity, 350.h));
        })
      });
}

SHOW NATIVE ADS #

        native,
4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Ads Implement

License

unknown (license)

Dependencies

flutter, get, http, meta, visibility_detector

More

Packages that depend on google_applovin_unity_ads