If you are trying to integrate admob advertisements, then it is wise to test it first. During development, it is recommended that you avoid false ad impressions as well as clicks. For that purpose, it is widely suggested that you just use test advertisements which displays a placeholder instead of a live advertisement. To get such test ads, you need to pass your hashed device ID to to AdRequest.Builder.addTestDevice().
Here is an example of how the code looks like:
AdRequest request = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice(“A2435BEFF94D5EFCFA0F050455C56347”) .build();
You need to find the unique hashed device id to add it to your code. The simplest way to find it in Android Studio is to look at the logcat in Android Monitor.
Here are the steps:
- Connect your test device with drivers installed, Developer Options and USB debugging enabled.
- In the bottom of Android Studio, click on Android Monitor and make sure the tab logcat is active.
- You will see a lot of messages. Type addTestDevice in the search field to filter the text.
- You will find your unique hashed device id in the results.
If you cannot find it using the logcat then you can use an app that displays the same device id.
I hope that helps you out in testing your advertisements and monetizing your application.