Which package implements RequestConfiguration to use with firebase_admob?

354 Views Asked by At

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

This app use firebase_admob package for implementing Google AdMob in the app. I was getting the above statement in the logcat terminal when using the Test Ads provided in https://developers.google.com/admob/android/test-ads#enable_test_devices in my Flutter App.

If I use RequestConfiguration.Builder().setTestDeviceIds... it gives

Undefined name 'RequestConfiguration'.

1

There are 1 best solutions below

0
Omor Faruqe On

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());
}

details in the link