Actually with the previous method the initialization of the Announcement was also carried out, this by means of the ad_unit_id
that defined a format and type of announcement, by means of which we configured our AdView
:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
ads:adSize="LARGE_BANNER"
ads:adUnitId="@string/banner_ad_unit_id" >
</com.google.android.gms.ads.AdView>
Now the current implementation requires AdMob with Firebase and this implementation requires what you comment, the Initialization in this way:
public class MainActivity extends AppCompatActivity {
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
MobileAds.initialize(this, "YOUR_ADMOB_APP_ID");
}
...
}
Both methods require initialization , previously the Ad unit id was used and now the is used AdMob app ID which is a unique ID assigned to your apps when they are added to AdMob. .
app ID : is a unique ID number assigned to your apps when they are added to AdMob. The ID of the application is used to identify your
applications.
ad unit ID : is a unique ID number assigned to each of your ad units when they are created in AdMob. The block ID of
Ads is added to the code of your application and used to
identify ad requests from the ad unit.