English 中文(简体)
如何从方案上获得Admob的装置识别器?
原标题:How to programmatically get the Device ID for Admob?

我有多种装置,我也许会有更多的装置,不想逐一增加。 是否有任何人知道ID Admob的用途?

问题回答
String aid = Settings.Secure.getString(getContext().getContentResolver(), "android_id");

Object obj = null;
try {
    ((MessageDigest) (obj = MessageDigest.getInstance("MD5"))).update(
                                   aid.getBytes(), 0, aid.length());

    obj = String.format("%032X", new Object[] { new BigInteger(1,
                                   ((MessageDigest) obj).digest()) });
} catch (NoSuchAlgorithmException localNoSuchAlgorithmException) {
    obj = aid.substring(0, 32);
}

我希望这将有助于你;

我尝试了这一点,给我带来了我ESN号码的Hex值。 这并不是AdMob的用途。

在Dalvic Debug监测记录中,当要求一名被告时,该记录显示需要使用的人数。

Also you might want to refer to the following page (about half way down): http://code.google.com/mobile/ads/docs/android/intermediate.html

Hi Note Down My answer ,if you want to get Device id, you can use TelephonyManager as i used below

String device_id=null;
TelephonyManager telemngr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
device_id=telemngr.getDeviceId();

您的发言也需要得到以下许可:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签