androidflutteradmobfirebase-admob

Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") to get test ads on this device


Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") to get test ads on this device.

I was getting this statement in the logcat terminal. When implementing the Google AdMob with the Test Ads provided in https://developers.google.com/admob/android/test-ads#enable_test_devices in my Flutter App.


Solution

  • Solution

    The way to solve it is to update RequestConfiguration with the testDeviceIds

    String version;
      List<String> testDeviceIds = ['289C....E6'];
    
    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      timeDilation = 1;
      PackageInfo packageInfo = await PackageInfo.fromPlatform();
      version = packageInfo.version;
      MobileAds.instance.initialize();
    
      // thing to add
      RequestConfiguration configuration =
           RequestConfiguration(testDeviceIds: testDeviceIds);
      MobileAds.instance.updateRequestConfiguration(configuration);
    
    
      await Firebase.initializeApp();
      runApp(MyApp());
    }
    

    How to get TestDeviceIDs

    If you want to test ads in your app as you're developing.

    Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("289.......E6") to get test ads on this device.