June 2018
Beginner to intermediate
394 pages
9h 2m
English
We need to initialize the SDK before we do any other actions. Now choose the action and make good use of the resources.
The following code snippet illustrates the SDK initialization:
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"); } ...}
In the layout XML design files, we can start using AdView as a component:
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adView" android:layout_width="wrap_content" ...
Read now
Unlock full access