Admob视频插页式广告/虚拟ID [英] Admob video Interstitial test/dummy id

查看:120
本文介绍了Admob视频插页式广告/虚拟ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在admob插页式视频广告的测试ID?

Is there a test id for admob interstitial video ad ?

我知道横幅和图像插页式广告的虚拟测试ID

i know dummy test id for banner and image interstitial


横幅广告:ca-app-pub-3940256099942544 / 6300978111

Banner : ca-app-pub-3940256099942544/6300978111

非页内广告:ca-app-pub-3940256099942544 / 1033173712

Interstitial:ca-app-pub-3940256099942544/1033173712

我需要用于视频插页式广告的虚拟测试ID

i need dummy test id for video interstitial

我已经知道如何添加测试设备ID

i already know how to add test device id

 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);

但是我想给其他设备编号未知的家伙演示

but i want to give demo to some other guy whose device id is unknown

所以有人可以给我

预先感谢

推荐答案

如此处回答:如何获取Admob的设备ID

您可以使当前运行

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 ID的md5 ,并且必须为大写。这是我使用的md5代码

You need to use the md5 of the Android ID, and it needs to be upper case. Here is the md5 code I used

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 "";
}

这篇关于Admob视频插页式广告/虚拟ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆