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:
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 | Google Map 2 | admin | 2017.05.29 | 30 |
7 | Google Map | admin | 2017.05.29 | 21 |
6 | Open Multiple Activities from Multiple Buttons | admin | 2017.05.24 | 39 |
5 | How To Create A Simple Web View In Xcode 8 (Swift 3.0) | admin | 2017.05.21 | 26 |
4 | ExpandableTextView | admin | 2017.05.17 | 36 |
3 | Android Tutorial 9 - The Navigation Drawer | admin | 2017.05.17 | 35 |
2 | Android options menu tutorial | admin | 2017.05.17 | 32 |
1 | How to make Mobile Web | admin | 2017.05.08 | 28 |