如何为iOS appcelerator项目找到ti.admob模块的测试设备ID

时间:2016-10-23 20:21:25

标签: ios admob titanium appcelerator appcelerator-titanium

我在appcelerator钛中有一个iOS移动应用程序正在使用Ti.Admob模块。当在simultaor中运行时,广告就在那里,但是当在设备上进行调试时,它是空白的。

查看文档我应该能够从console.log获取测试设备ID,并将其添加到createView函数中的testDevices数组中,但我无法在任何地方找到测试设备ID。 / p>

似乎绝对疯狂,任何想法?

1 个答案:

答案 0 :(得分:0)

事实证明,有问题的ID是手机广告标识符的MD5哈希值。我下载了一个名为The Identifiers的应用,它可以为您提供所需的所有信息。

将广告标识符的MD5哈希值添加到createView方法中的testDevices数组中,然后您将在应用中看到广告。

var ad1 = Admob.createView({
             height: 50,
             top: 0,
             debugEnabled: true, // If enabled, a dummy value for `adUnitId` will be used to test
             adType: Admob.AD_TYPE_BANNER,
             adUnitId: 'ca-app-pub-000000xxxxxxxxxx/8204200000', // You can get your own at http: //www.admob.com/
             adBackgroundColor: 'black',
             testDevices: [Admob.SIMULATOR_ID,'xxxc8xx0xxxccxxb4a12cxxxxxxxxxxx'], // You can get your device's id by looking in the console log
              dateOfBirth: new Date(1985, 10, 1, 12, 1, 1),
              gender: Admob.GENDER_MALE, // GENDER_MALE or GENDER_FEMALE default: undefined
             contentURL: 'https://admob.com', // URL string for a webpage whose content matches the app content.
             requestAgent: 'Titanium Mobile App', // String that identifies the ad request's origin.
    extras: {
       'version': 1.0,
       'name': 'Eyespy'
    }, // Object of additional infos
    tagForChildDirectedTreatment: false, // http:///business.ftc.gov/privacy-and-security/childrens-privacy for more infos
     keywords: ['keyword1', 'keyword2']
     });

    $.adview.add(ad1);