简体   繁体   English

将Chartboost与MoPub集成

[英]Integrating Chartboost with MoPub

I'm having trouble with the integration steps from MoPub : 我在MoPub的集成步骤上遇到了麻烦:

  1. Integrating using the SDK Source 使用SDK源进行集成
    • I added ChartboostInterstitial.java and ChartboostShared.java to \\app\\src\\main\\java\\com\\mopub\\mobileads\\ 我将ChartboostInterstitial.java和ChartboostShared.java添加到\\ app \\ src \\ main \\ java \\ com \\ mopub \\ mobileads \\
  2. Link the third party SDKs 链接第三方SDK
    • I added chartboost.jar to app\\libs 我将chartboost.jar添加到app \\ libs
    • I added compile files('libs/chartboost.jar') under dependencies 我在依赖项下添加了编译文件('libs / chartboost.jar')
    • I followed Chartboost's integration steps up to the point of adding my appID and appSignature (Step 7) 我遵循了Chartboost的集成步骤,直到添加了我的appID和appSignature(第7步)

At this point I'm confused because I already input my appID and appSignature into MoPub's dashboard. 此时,我很困惑,因为我已经将我的appID和appSignature输入到MoPub的仪表板中。 I removed Chartboost.startWithAppId(this, appId, appSignature); 我删除了Chartboost.startWithAppId(this,appId,appSignature); and only kept onCreate but MoPub's ChartboostInterstitial class is still being marked as unused. 并且仅保留onCreate,但MoPub的ChartboostInterstitial类仍被标记为未使用。 This doesn't seem right. 这似乎不正确。

Any ideas? 有任何想法吗? MoPub's documentation in this area seems unclear. MoPub在这方面的文档似乎不清楚。

Steps you need to do: 您需要执行的步骤:

  1. Integrate MoPub as instructed in this document 按照本文档中的说明集成MoPub
  2. Implement your MoPub Interstitial display logic according to this document 根据此文档实施MoPub非页内广告显示逻辑
    At this point, you should be able to display MoPub Interstitial. 此时,您应该可以显示MoPub非页内广告。 But as you want to mediate Chartboost, you need to do extra steps following. 但是,要调解Chartboost时,您需要执行以下附加步骤。
  3. Add ChartboostInterstitial.java and ChartboostShared.java to your project's app/src/main/java/com/mopub/mobileads/ ChartboostInterstitial.javaChartboostShared.java添加到项目的app/src/main/java/com/mopub/mobileads/
  4. Add Chartboost SDK to libs/ and add play-services-ads:8.4.0 as dependencies. 将Chartboost SDK添加到libs/并添加play-services-ads:8.4.0作为依赖项。 Download the Chartboost SDK jar here . 此处下载Chartboost SDK jar。
    You don't need to import or call any Chartboost SDK class/method in your code. 您无需在代码中导入或调用任何Chartboost SDK类/方法。
  5. Fill in Chartboost App ID and App Signature in MoPub's dashboard and set up a Interstitial Ad Unit which mediates Chartboost. 在MoPub的信息中心中填写Chartboost应用ID和应用签名,并设置一个插播Chartboost的非页内广告单元。 Use this Ad Unit in your app to show Interstitial! 在您的应用中使用此广告单元来展示插页式广告!

Check that you have added all libraries needed, all Activity and required permissions declared in AndroidManifest.xml . 检查是否已添加所有必需的库,在AndroidManifest.xml声明的所有Activity和必需的权限。

AndroidManifest.xml: AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application>
    <activity android:name="com.mopub.mobileads.MoPubActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.common.MoPubBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>
    <activity android:name="com.mopub.mobileads.RewardedMraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>

    <activity android:name="com.chartboost.sdk.CBImpressionActivity"
           android:excludeFromRecents="true"
           android:hardwareAccelerated="true"
           android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
           android:configChanges="keyboardHidden|orientation|screenSize" />

    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
</application>

If you use Gradle, your build.gradle dependencies should probrably look like this: 如果您使用Gradle,则build.gradle依赖项应该看起来像这样:

dependencies {
    // ... other project dependencies

    // Compile the chartboost.jar in libs/
    compile fileTree(dir: 'libs', include: ['*.jar']
    // Google Play Services
    compile 'com.google.android.gms:play-services-ads:8.4.0
    //MoPub
    compile('com.mopub:mopub-sdk:4.12.0@aar') {
        transitive = true
    }
    compile('com.mopub:mopub-sdk-interstitial:4.12.0@aar') {
        transitive = true
    }
    compile 'com.mopub.volley:mopub-volley:1.1.0'

    compile 'com.android.support:support-v4:22.0.+'
    compile 'com.android.support:support-annotations:22.0.+'
    compile 'com.android.support:recyclerview-v7:22.0.+'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM