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

Ads Implement

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_applovin_unity_ads/banner/banner_ad_widget.dart';
import 'package:google_applovin_unity_ads/banner/controller.dart';
import 'package:google_applovin_unity_ads/google_applovin_unity_ads.dart';
import 'package:google_applovin_unity_ads/native/controller.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(double.infinity, double.infinity),
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (context, child) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            // This is the theme of your application.
            //
            // Try running your application with "flutter run". You'll see the
            // application has a blue toolbar. Then, without quitting the app, try
            // changing the primarySwatch below to Colors.green and then invoke
            // "hot reload" (press "r" in the console where you ran "flutter run",
            // or simply save your changes to "hot reload" in a Flutter IDE).
            // Notice that the counter didn't reset back to zero; the application
            // is not restarted.
            primarySwatch: Colors.blue,
          ),
          home: const MyHomePage(title: 'Flutter Demo Home Page'),
        );
      },
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  String loadAdMob = "";
  String showAdMob = "";
  Widget nativeAd = Container(height: 0,);



  void afteradsCallback() {
    print("Callback completed after ad function");
  }

  Future<void> _loadAds() async {
    // GoogleApplovinUnityAds.showIntraAds(callback: afteradsCallback);
    setState(() {
      nativeAd = GoogleApplovinUnityAds.nativeAds(NativeSize(Size(double.infinity, 360.h)), "F");
      loadAdMob = "Ads Will Starting";
    });
  }

  Future<void> _loadRewardAds() async {
    GoogleApplovinUnityAds.showRewardAds(callback: afteradsCallback);

    setState(() {
      showAdMob = "Reward Ads Will Starting";
    });
  }

  @override
  void initState() {
    super.initState();
    // ca-app-pub-3940256099942544/8691691433
    GoogleApplovinUnityAds.initialize("""
    {	
    "ads_sequence": [
      "google_ads"		
    ],	
	"more_app_url": "https://play.google.com/store/apps/developer?id=YoYo+Live+LLC.", 	
	"extra_url": "https://raw.githubusercontent.com/pkbitcoding/booya/main/App_Setting.json", 	
	"ad_setting": {
		"app_version_code": 16,		
		"is_full_ads": true,
		"is_geoedge_sdk_flag": true,
    "is_analytics_flag": true,
    "geoedge_sdk_key": "b6ce4420-59b1-437e-8c73-e32a2ab87cff",		
		"onesignal_id": "ae6e77d4-07e5-42ba-a8ef-6b396d1bfe11", 
		"ads_loading_text": "Ad is loading...",
		"seconds_require_triger_reward": 1,	
		"global_intra_interval_click": 1,
		"interstitial_ad_time_interval": 1
	},
	"app_update": {
		"is_popup_dialog": false,
		"is_update_require": false,
		"package_id": "com.booya.videochat", 
		"website_url": "https://play.google.com/store/apps/details?id=com.booya.videochat", 
		"app_icon": "https://play-lh.googleusercontent.com/OwvRNTvvyUo8g9MQUdJJBGT_cL4S7ObS_xCyzwHYTS-rLrapbZzD1cQYowyHy-uVgw=w240-h480-rw",
		"updated_version_code": 50,
		"title": "App Update",
		"default_message": "Your App need an update."
	},
	"exit_dialog": {
		"is_exit_require": true,
		"exit_title": "Exit",
		"exit_message": "Do you want to exit from App?"
	},
	"reward_dialog": {
		"is_reward_require": true,
		"reward_message": "Would you like to call more Persons?"
	},
	"About_App": {
		"is_override": false,
		"is_about_app": true,
		"about_title": "YOYO: Live Random Video Chat", 
		"about_message": "YOYO: Live Random Video Chat",
		"registration_detail": "YOYO: Live Random Video Chat", 
		"version_detail": "version : 1.0.0"
	},
	"rate_app": {
		"is_rate_app": true,
		"package_id": "com.yoyolive.llc", 
		"rate_app_url": "https://play.google.com/store/apps/details?id=com.yoyolive.llc", 
		"rate_message": "Please Rate us and promote us."
	},
	"share_app": {
		"is_share_app": true,
		"share_title": "Share link url :https://play.google.com/store/apps/details?id=com.yoyolive.llc", 
		"share_message": "Now anyone can get YOYO : Random ideo calling app : https://play.google.com/store/apps/details?id=com.yoyolive.llc" 
	},
	"privacy_policy": {
		"is_privacy_policy": true,
		"is_system_browser": true,
		"privacy_policy": "https://yoyolive.github.io/privacy-policy.html" 
	},
	"terms_of_use": {	
		"is_terms_of_use": true,
		"is_system_browser": true,
		"terms_of_use": "https://yoyolive.github.io/privacy-policy.html" 
	},	
	"error_report": {	
		"is_error_report_support": true,
		"email_id": "mailto: yoyolive.llc@gmail.com"
	},	
	"feedback_support": {	
		"is_feedback_support": true,
		"email_id":"mailto:yoyolive.llc@gmail.com",
		"feedback_title": "Feedback on YOYO: Live Random Video Chat",
		"feedback_message": "Hi,\n\n\nYour Feedback YOYO: Live Random Video Chat! I would like to give you some feedback:",
		"email_subject": "Feedback on YOYO: Live Random Video Chat",
		"email_message": "Hi,\n\n\nYour Feedback YOYO: Live Random Video Chat! I would like to give you some feedback:"
		
	},	
	"google_ads": {	
		"banner_ad_unit_id_android": "/6499/example/banner", 
		"interstitial_ad_unit_id_android": "ca-app-pub-3940256099942544/1033173712", 
		"app_open_ad_unit_id_android": "ca-app-pub-3940256099942544/3419835294", 
		"native_ads_unit_id_android": "/6499/example/native", 
		"rewared_ads_unit_id": "/21798997504/ace_app_bitcoding_com.iptv.m3u.playlists_native", 
		"native_video_ads_unit_id_android": "/6499/example/native", 
		"is_banner_ads": true,
		"is_open_ads": true,
		"is_interstitial_ads": true,
		"is_rewared_ads": true,
		"is_native_ads": true,
		"no_of_click_interstitial": 1
	},	
	"facebook_ads": {	
		"banner_ad_unit_id_android": "1256108584835955_1449684088811736", 
		"interstitial_ad_unit_id_android": "1256108584835955_1449687305478081", 
		"rewared_ads_unit_id": "1256108584835955_1449687305478081", 
		"native_ads_unit_id_android": "1256108584835955_1449687385478073", 
		"is_banner_ads": true,
		"is_interstitial_ads": true,
		"is_rewared_ads": true,
		"is_native_ads": true
	},
	"custom_ads": {	
		"qureka_link": "https://490.go.qureka.com/intro/question",
		"is_quraka_banner": true,
		"is_quraka_intera": true,
		"close_button_to_direct_web": true,
		"quraka_intra_image": [
		"https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/360X640_1.png?raw=true",
		"https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/360X640_2.png?raw=true",
		"https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/360X640_3.png?raw=true",
		"https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/360X640_4.png?raw=true",
		"https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/360X640_5.png?raw=true",
		"https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/360X640_6.png?raw=true"
    ],	
    "quraka_banner_image": [	
      "https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/2.jpg?raw=true",
      "https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/3.jpg?raw=true",
      "https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/320x50.jpg?raw=true",
      "https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/4.jpg?raw=true",
      "https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/5.jpg?raw=true",
      "https://github.com/pragneshpalsanabitcoding/image_quraka/blob/main/6.jpg?raw=true"
    ]	
	},	
	"app_lovin": {	
		"is_unlimited_ads": true,
		"id_unit_banner": "94ebe8395e6d2805",
		"id_unit_intra": "732f7644514283c8",
		"id_unit_native": "",
		"id_unit_native_multiple": {
      "small":"9632213c2b615176",
      "medium":"8e4ac4cda97b3d52",
      "manual":"b8408ff8ba0188c3"
    },
		"rewared_ads_unit_id": "dcfeacb6e0984c4c",
		"is_banner_ads": true,
		"is_interstitial_ads": true,
		"is_native_ads": true,
		"is_rewared_ads": true
	},
	"extra_google_ads": [{
		"banner_ad_unit_id_android": "/6499/example/banner",
		"interstitial_ad_unit_id_android": "ca-app-pub-3940256099942544/1033173712", 
		"app_open_ad_unit_id_android": "ca-app-pub-3940256099942544/3419835294", 
		"native_ads_unit_id_android": "ca-app-pub-3940256099942544/2247696110", 
		"rewared_ads_unit_id": "/6499/example/native", 
		"native_video_ads_unit_id_android": "/6499/example/native-video", 
		"is_banner_ads": true,
		"is_open_ads": true,
		"is_interstitial_ads": true,
		"is_rewared_ads": true,
		"is_native_ads": true,
		"no_of_click_interstitial": 1
	}]
	}
    """, callback: () => {
      print(" ---  ----- Initialize Callback()")
    });
  }

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context);
    return SafeArea(child: Column(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children : [ Container(
          margin: EdgeInsets.all(8.0),
          width: double.infinity,
          height: 60,
          child: Material(
            color: Colors.transparent,
            child: InkWell(
              borderRadius: BorderRadius.all(Radius.circular(10)),
              onTap: () => _loadAds(),
              child: Ink(
                child: Container(
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10)),
                    color: Colors.black,
                  ),
                  alignment: Alignment.center,
                  child: Padding(
                    padding: EdgeInsets.symmetric(vertical: 16.0),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text("Show Native Ads",
                            style: TextStyle(
                                fontSize: 20,
                                fontWeight: FontWeight.bold,
                                color: Colors.white)),
                      ],
                    ),
                  ),
                ),
              ),
            ),
          )), nativeAd],
    ));

    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Center(
          // Center is a layout widget. It takes a single child and positions it
          // in the middle of the parent.
          child: Column(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Container(
                  margin: EdgeInsets.all(8.0),
                  width: double.infinity,
                  height: 60,
                  child: Material(
                    color: Colors.transparent,
                    child: InkWell(
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                      onTap: () => _loadAds(),
                      child: Ink(
                        child: Container(
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.all(Radius.circular(10)),
                            color: Colors.black,
                          ),
                          alignment: Alignment.center,
                          child: Padding(
                            padding: EdgeInsets.symmetric(vertical: 16.0),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Text("Show Intrestial Ads",
                                    style: TextStyle(
                                        fontSize: 20,
                                        fontWeight: FontWeight.bold,
                                        color: Colors.white)),
                              ],
                            ),
                          ),
                        ),
                      ),
                    ),
                  )),
              SizedBox(height: 24.h),
              /*Container(
                  margin: EdgeInsets.all(8.0),
                  width: double.infinity,
                  height: 60,
                  child: Material(
                    color: Colors.transparent,
                    child: InkWell(
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                      onTap: () => _loadRewardAds(),
                      child: Ink(
                        child: Container(
                          decoration: BoxDecoration(
                            borderRadius:
                            BorderRadius.all(Radius.circular(10)),
                            color: Colors.black,
                          ),
                          alignment: Alignment.center,
                          child: Padding(
                            padding: EdgeInsets.symmetric(vertical: 16.0),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Text("Show Reward Ads",
                                    style: TextStyle(
                                        fontSize: 20,
                                        fontWeight: FontWeight.bold,
                                        color: Colors.white)),
                              ],
                            ),
                          ),
                        ),
                      ),
                    ),
                  )),
              SizedBox(height: 16.h),*/
              /*GoogleApplovinUnityAds.nativeAds(NativeSize.SMALL_NATIVE, Colors.transparent),
              SizedBox(height: 16.h),*/
              Container(height: 100, child: Container()),
            ],
          ),
        ) // This trailing comma makes auto-formatting nicer for build methods.
        );
  }
}
4
likes
0
pub points
35%
popularity

Publisher

unverified uploader

Ads Implement

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on google_applovin_unity_ads