How can I get the device string of a physics phone? - android

In order not to violate policy of Google AdMob AD, I add my physics phone to test device using Code A.
I get the device string "Samsung SM-J5008" of the physics phone using the following UI when I select a device to run the App.
I don't know whether the string "Samsung SM-J5008" is correct, and more the Google AD is still displayed even if I have added the code .addTestDevice("Samsung SM-J5008")
And More
I don't need to remove addTestDevice() when I publish my app, all physical phones will display AD except these physical phones who's name string listed in addTestDevice(), is it right?
Code A
val adRequest = AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("Samsung GT-I9268")
.addTestDevice("Samsung SM-J5008")
.build()
adView.loadAd(adRequest)

When you run the project, if you monitor the LogCat, you can find a similar line Use AdRequest.Builder.addTestDevice(“C04B1BFFB0774708339BC273F8A43708”) to get test ads on this device. Copy the device id and add it to AdRequest.
Note that this ID varies from device to device, By doing this, the test ads will be loaded instead of live ads.
In production you need to make sure that you removed addTestDevice() methods in order to render the live ads and start monetization.

If you are running admob ads on an emulator then there is no ID. just use the AdManager method and set it to TEST_EMULATOR like the logcat says. If you run on an actual device with usb debugging and watch the logcat, the ID will appear in there.You need to add device ID As :
String android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
String deviceId = md5(android_id).toUpperCase();
Log.i("device id=",deviceId);

Related

Do i need to first request a real Ad to get the Device ID from the logcat so i can add a testdevice?

In the documentation it says you should add a test device this way.
But to get this ID from the logcat do i have to first Request a real ad? Isn't that against their own policy to request real ads?
Add your test device
Load your ads-integrated app and make an ad request. Check the logcat
output for a message that looks like the one
below, which shows you your device ID and how to add it as a test
device:
I/Ads: Use
AdRequest.Builder.addTestDevice("33BE2250B43518CCDA7DE426D04EE231") to
get test ads on this device."
There are a) test ad units, which one can use and b) it knows when it is running in debug mode.
This message likely shows in the log before showing any ad unit, but when instancing the client.

Should the ad banner displayed as soon as I put the codes?

I Applied all steps given to me by Admob to enable ads on my android app ,
but I didn't really register (or give full information) in Adsense ,
so , when I run my app with (Test Banner Id ) then the ads are displayed.
but when I run my app with (Banner Id that given to me by admob) then the ads are not displayed .
is that normal ??
or I have problem ?
You can check whether your real admob working or not by adding your device as test device(By default all emulators are considered as test device).
Add your test device
Load your ads-integrated app and make an ad request.
Check the logcat output for a message that looks like this:
I/Ads: Use AdRequest.Builder.addTestDevice("33BE2250B43518CCDA7DE426D04EE232")
to get test ads on this device.
Copy your test device ID to your clipboard.
Modify your code to call AdRequest.Builder.addTestDevice() with your test device ID. This method can be called multiple times for multiple devices.
AdRequest request = new AdRequest.Builder()
.addTestDevice("33BE2250B43518CCDA7DE426D04EE232")
.build();
If ads are visible on your test device with real id then no problem otherwise you have to check.
Note: Be sure to remove the code that sets these test devices before you release your app.

Google AdMob Code Issue (Running Live Mode ?!)

I signed up for Google AdMob services recently and been using this code to create the AdRequest.
private AdRequest createAdRequest()
{
return new AdRequest.Builder()
.AddTestDevice(AdRequest.TestDeviceSimulator)
.AddTestDevice("0123456789ABCDEF0123456789ABCDEF")
.AddKeyword("game")
.SetGender(Gender.Male)
.SetBirthday(new DateTime(1985, 1, 1))
.TagForChildDirectedTreatment(false)
.AddExtra("color_bg", "9B30FF")
.Build();
}
When logging in today morning, I saw some impression (around 100) created obviously by myself. The TestDevice ID is of course not the correct ID because I was too lazy to find out the correct one.
Are the ads showing right now in my app "real" ads? Can I fix this by adding the correct device ID and will I see then inside App that the Ads are just "Demo"?
... Is there no "general testing-mode" ? I'm developing together with a friend and he has of course a different device ID...
Thanks in advance
You can add multiple device IDs, no problem:
.AddTestDevice("YOURDEVICEIDYOURDEVICEIDYOURDEVICEID")
.AddTestDevice("FRIENDSDEVICEIDFRIENDSDEVICEIDFRIEND")
.AddTestDevice("SOMEONEELSESOMEONEELSESOMEONEELSESOM")
Now your friends and you will see demo ads, all the rest will see real ads.
To get the device id you can start your app and check the logcat for an admob log that looks more or less like this:
05-20 20:27:20.888: I/Ads(32367): Use AdRequest.Builder.addTestDevice("BANANANAANANANANANANNANANANANANA") to get test ads on this device.
Just use this id as a parameter in the addTestDevice method then. See also this related admob question

Using app with AdMob as developer

I have read the rules in the AdMob page and have tried to find an answer for this there. Couldn't find an answer there or somewhere to contact them so I'll try here.
It says the developer shouldn't inflate the earnings. Is this by clicking ads only or also by just loading an app.
Does it mean that as developer I can't use my own app, or just that I shouldn't press the ads?
Also, what is the purpose of having to give AdMob the deviceID? What is that used for? What would happen if you give it something similar instead (if it is just intrusive and doesn't serve a purpose)?
You Can use ur app as well as you also can tap on those ads,
Just impement a Method into AdRequest calls addtestdevice("DEVICEID")
Now Question is WHAT IS DEVICE ID, and How to get it,
Here is the Method to get DEVICE ID
String android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
String deviceId = md5(android_id).toUpperCase();
For e.g.
mAdRequest.addTestDevice(deviceId);
If You want to use it on Emulator the Emulator device id is TEST_EMULATOR
Hope it helps.
Cheers
-Aman

Should I get device ID for Admob when i publish my add

AdRequest adRequest = new AdRequest.Builder()
addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
addTestDevice("HASH_DEVICE_ID")
build();
I just use my device ID or How can i remove test mode and use the Correct mode
-How can I change it ?
No, you don't need to remove this
addTestDevice(AdRequest.DEVICE_ID_EMULATOR) addTestDevice("HASH_DEVICE_ID");
It has been provided in such a way that only the emulator and your own devices will get test ads. For Example I use my apps even after releasing them and i always keep this code included. I download app on my devices again from play store and use them. It shows test ads only on my device (and the devices whose Device ID I have included). So all other users in the world get Real ad impressions.
Welcome,
You will put the Device ID of the AVD emulator where you want to test if Admob works, I have an app using Admob with the Device ID of my emulator test mode and it works fine on real devices. It doesn't show the test banner. But if you want to quit it then your code will look like this:
AdRequest adRequest = new AdRequest.Builder().build();

Categories

Resources