Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android get device ID for adMob [duplicate]

Possible Duplicate:
How can I get device ID for Admob

I am testing adMob on my android device and following with documentation, I am trying to get device ID executing adRequest. However, I am not able to find device ID in the logCat! What I am doing wrong?

 AdRequest adRequest = new AdRequest();
 adRequest.addTestDevice(AdRequest.TEST_EMULATOR);            
 adRequest.addTestDevice("test");     

Edit: it is not a duplicate, those methods from other post are not working for me.

like image 985
Jaume Avatar asked Mar 13 '12 09:03

Jaume


People also ask

How can I get Android device ID?

There are several ways to know your Android Device ID 1- Enter *#*#8255#*#* in your phone dialer, you'll be shown your device ID (as 'aid') in GTalk Service Monitor. 2- Another way to find the ID is by going to the Menu >Settings > About Phone > Status.

Does Admob use advertising ID?

In admob, the advertising ID is available via the google play services library and not the deprecated GoogleAdmobADSSdk-6. X.X. jar. So in future, if you wish to monetize your apps using admob, just make sure you use admob via the google play service library.

What is interstitial ID?

Interstitial ads are full-screen ads that cover the interface of their host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game.


2 Answers

Make a live ad request while running on the device, and view the logs. There should be a log at the info level that says:

I/Ads: To get test ads on this device, call adRequest.addTestDevice("YOUR_HASHED_DEVICE_ID");

Since the SDK hashes your device ID, it is much easier and cleaner to grab this number directly through the logs rather than bothering to try to grab the Android device ID, and doing some manual hashing to try to get this same number.

like image 116
Eric Leichtenschlag Avatar answered Oct 07 '22 02:10

Eric Leichtenschlag


 final TelephonyManager tm =(TelephonyManager)getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);

String deviceid = tm.getDeviceId();
like image 39
Pradeep Sodhi Avatar answered Oct 07 '22 02:10

Pradeep Sodhi