Wednesday, 15 February 2012

android - How to get Device id for Admob -



android - How to get Device id for Admob -

i added admob advertisement in application, device id required admob find next code,

string android_id = settings.secure.getstring(this.getcontentresolver(), settings.secure.android_id); device_id = md5(android_id).touppercase(); public static string md5(string s) { seek { messagedigest digest = java.security.messagedigest.getinstance("md5"); digest.update(s.getbytes()); byte messagedigest[] = digest.digest(); stringbuffer hexstring = new stringbuffer(); (int i=0; i<messagedigest.length; i++) hexstring.append(integer.tohexstring(0xff & messagedigest[i])); homecoming hexstring.tostring(); } grab (nosuchalgorithmexception e) { e.printstacktrace(); } homecoming ""; }

the problem showing ads on devices on devices shows test ads. wrong?? pls help

addtestdevice used showing admob test ads development.so in deployment remove addtestdevice adrequest,i.e. create adrequest as

adrequest adrequest = new adrequest.builder().build(); adview.loadad(adrequest);

and if want device id testing see how can device id admob add together addtestdevice in adrequest

adrequest adrequest = new adrequest.builder() .addtestdevice(device_id) .build(); adview.loadad(adrequest);

android admob

No comments:

Post a Comment