Android Admob视频间隙测试/虚拟id
是否有admob中间视频广告的测试id 我知道横幅和图像间隙的虚拟测试id 条幅:ca-app-pub-3940256099942544/630978111 间隙:ca-app-pub-3940256099942544/1033173712 我需要一个虚拟测试id来进行视频插入 我已经知道如何添加测试设备idAndroid Admob视频间隙测试/虚拟id,android,admob,Android,Admob,是否有admob中间视频广告的测试id 我知道横幅和图像间隙的虚拟测试id 条幅:ca-app-pub-3940256099942544/630978111 间隙:ca-app-pub-3940256099942544/1033173712 我需要一个虚拟测试id来进行视频插入 我已经知道如何添加测试设备id AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.B
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("TEST_DEVICE_ID")
.build();
adView.loadAd(adRequest);
但我想把这个演示给另一个设备id未知的人
有人能告诉我答案吗
视频跨段测试id
提前感谢如下所述:
您可以通过编程方式将当前正在运行的设备设置为adview测试设备
if(YourApplication.debugEnabled(this)) //debug flag from somewhere that you set
{
String android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
String deviceId = md5(android_id).toUpperCase();
mAdRequest.addTestDevice(deviceId);
boolean isTestDevice = mAdRequest.isTestDevice(this);
Log.v(TAG, "is Admob Test Device ? "+deviceId+" "+isTestDevice); //to confirm it worked
}
您需要使用Android的md5,并且它必须是大写的。这是我使用的md5代码
public static final String md5(final String s) {
try {
// Create MD5 Hash
MessageDigest digest = java.security.MessageDigest
.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex String
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
String h = Integer.toHexString(0xFF & messageDigest[i]);
while (h.length() < 2)
h = "0" + h;
hexString.append(h);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
Logger.logStackTrace(TAG,e);
}
return "";
}
公共静态最终字符串md5(最终字符串s){
试一试{
//创建MD5散列
MessageDigest=java.security.MessageDigest
.getInstance(“MD5”);
更新(s.getBytes());
字节messageDigest[]=digest.digest();
//创建十六进制字符串
StringBuffer hexString=新的StringBuffer();
for(int i=0;i
所谓“视频插播”,是指“有奖广告”吗?我知道,我不知道客户端在测试我的应用程序时将使用什么设备。此代码将帮助您从客户端设备获取设备id,然后发送请求以获取广告。/*String android\u id=Settings.Secure.getString(this.getContentResolver(),Settings.Secure.android\u id);字符串deviceId=md5(android_id).toUpperCase();*/[用于获取设备ID]/*mAdRequest.addTestDevice(deviceId);*/[请求添加测试设备]这可以工作,但它仍然显示图像Interstatial,但不显示视频Interstatial