Admob test id keeps changing

Viewed 1966

Recently I bought a new phone(Xiaomi Mi A2) and very weird thing happens when I try to test my apps on it. Admob test id keeps changing. I copy the id from the logs as always("Use AdRequest.Builder.addTestDevice("XXXXXXXX") to get test ads on this device"). I add it to the AdRequest.Builder. I run the app and at first everything works fine I get test ads, but then the next day the admob id changes and I get real ones. Today I got 3 different ids (happened each time I restarted Android Studio). This never happens with my other phone.

I don't know if its related but sometime my device is recognized as Xiaomi Mi A2 and sometimes it just shows null(XXXX). I can't get any logs when its null but I can install the app normally. Restarting Android Studio helps with that.

What could possibly cause this? Is this a problem with Android Studio or my phone?

EDIT: I think I found the reason. My new device has Android 8.1 and apparently ANDROID_ID is different for every app and can change if the signing key is different https://developer.android.com/about/versions/oreo/android-8.0-changes

1 Answers

So I'm not sure I understand your question. When you say that the ID's keep changing, which Id are you referring to, App ID or Ad Unit Id?

After you set up your AdMob account, you should get just 1 App Id. That Id can be used for Banner, Interstitial, Reward and so on.

The test Ad Unit Ids are:

Banner: Test Ad Unit Id: ca-app-pub-3940256099942544/6300978111

Interstitial: Test Ad Unit Id: ca-app-pub-3940256099942544/1033173712

Rewarded: Test Ad Unit Id: ca-app-pub-3940256099942544/5224354917

When you use the Banner Test Ad Unit Id, there are at least 3 little Ads that can pop up, it's up to their server which test Ad you see.

When you use the Interstitial Test Ad Unit Id, I have seen two different Ads.

And with Reward Test Ad Unit Id I have seen 2 different Ads.

But the ID's never change, not that I have seen. Can you be more specific?

Related