Reputation: 61
I have an app ready to be published on store on which I've used Banner Ads from Admob and I've been using a Test ID as of late. I have my Admob ID with me, but can I update the test ID with the real ID and run it on the emulator once for updating the code? As far as I know the changes aren't reflected back in the .apk file until the project isn't run again on the emulator.
I fear since this is a live ad, I cannot use it for development purpose. Also, what changes would I need to make in an order to get the app working with live ads? Any help will be highly appreciated.
Upvotes: 0
Views: 3251
Reputation: 941
No. You must not use live ads even once during development, Your account will be suspended.
Update your Admob ID and see advertising data in your dashboard after publishing the update. Never use live ads
Go to strings.xml and find this line
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
and replace the contents of <string>
tag with your admob id and publish. But do not view live ads. To test your admob ID use addTestDevice as mentioned by @Virus
Upvotes: 2
Reputation: 33438
If you added a device id as test device, only that device will get test ads. When you generate a signed apk and upload it to production all other device will get live ads. Your device will continue to get test ads since the test device id is hard coded. If you want to receive live ads on your device too after publishing it. Remove the test device id before generating the signed apk for publishing.
If your apps is already working with ads and you are just changing the ad unit id
, there is no need to test as long as you are correctly replacing the ad unit it string.
Following is how you should ad test device ids
:
AdRequest request = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators
.addTestDevice("AC98C820A50B4AD8A2106EDE96FB87D4") // An example device ID
.build();
Do not remove DEVICE_ID_EMULATOR
and you'll never get live ads on your emulator.
The second id is your test device id, remove it only if you want to start getting live ads on the device. I would suggest leave it to avoid the complication of accidentally clicking ads on your own app and getting banned by google.
Upvotes: 6