I am trying to advertise inside my application. According to Admob Documentation I need to initialize the SDK mobile ads
MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");
This causes a splash when using high-level use in code.

But if I delete this line, the usage time is exchanged, and this line of code does not seem to affect the placement of ads inside the application.

Also, when requesting an ad from using admob ram again pops up and triggers 3-4 GC events when the application starts. I believe this is a memory leak.
Here, as I request an ad in the onCreate method
AdRequest request = null; if (BuildConfig.DEBUG) { //Facebook Audience Network List<String> testDeviceId = new ArrayList<>(); testDeviceId.add("TESTID");//Redmi Note 3 testDeviceId.add("TESTID");//Moto G 1st Gen AdSettings.addTestDevices(testDeviceId); //Google Ad-mob request = new AdRequest.Builder() .addTestDevice("TESTID")//Redmi Note 3 .addTestDevice("TESTID")//Mot G 1st Gen .build(); } else { request = new AdRequest.Builder() .build(); } AdView mAdView = findViewById(R.id.adView); mAdView.loadAd(request);
When you load these banner ads, you get several GC events. If I don't load ads, the GC event never kicks.

Is this behavior normal with admob? How can i solve this?
source share