today:
147
yesterday:
242
Total:
1,004,305

Import the Mobile Ads SDK

admin 2017.07.21 01:58 Views : 1084

Before loading ads, have your app initialize the Mobile Ads SDK by calling MobileAds.initialize() with your AdMob App ID. This only needs to be done once, ideally at app launch. You can find your app's App ID in the AdMob UI.

Here's an example of how to call the initialize() method in an Activity:

Example MainActivity.java (excerpt)

package ...
import ...
import com.google.android.gms.ads.MobileAds;

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");
   
}
   
...
}
No. Subject Author Date Views
8 Main Activity admin 2017.06.02 32
7 Android options menu tutorial admin 2017.05.17 32
6 Google Map 2 admin 2017.05.29 30
5 Menu admin 2017.06.02 29
4 mnifest solatoz 2017.06.02 28
3 How to make Mobile Web admin 2017.05.08 28
2 How To Create A Simple Web View In Xcode 8 (Swift 3.0) admin 2017.05.21 26
1 Google Map admin 2017.05.29 21