-1

I have integrated InMobi in mopub network. I have put the code of mopub along with its xml. Is it needed to put Inmobi code along with mobup. if yes,then which xml will use. Please help me regarding this.

//My code

moPubView = (MoPubView) rootView.findViewById(R.id.adview);

        moPubView.setAdUnitId("6d9c103be7aa446ab94e543462a390d8");
        moPubView.forceRefresh();
        moPubView.loadAd();

//My xml

<com.mopub.mobileads.MoPubView
    android:id="@+id/adview"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    ads:loadAdOnCreate="true"/>
Anjali
  • 206
  • 3
  • 10

1 Answers1

1

For integrating MOpub in android use following process with suggested code---

Add these to AndroidManifest.xml

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

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

Also Add google play services library.

Add these code on Activity with you ADD_UNIT_ID

mAdView = (MoPubView) findViewById(R.id.adview);
boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
mAdView.setAdUnitId(ADD_UNIT_ID);
mAdView.loadAd();

Add this in xml

                  <com.mopub.mobileads.MoPubView
                    android:id="@+id/adview"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal" />

And Add following Mopub SDK link

PankajSharma
  • 1,529
  • 14
  • 27
  • yes,I have added this.But I have also use Inmobi which is in the mopub as a network.then for this I have to add sdk as well as code along with mopub or mopub automatically handle this – Anjali Aug 20 '14 at 07:40