Reputation: 1650
In android app i am developing, i have successfully added MoPubView and MoPubInterstitial and integrated with AdMob from Google. There is one note on MoPub docs, that we should manage permissions (whether WRITE_EXTERNAL_STORAGE is allowed or not). This permission is required for MRAID. As i understood MRAID ads can be shown in MoPubInterstitial as videos and client is allowing MRAID to be shown. I dont wont an app to crash if user interacts with MRAID content.
How to check whether MRAID is loaded and where to place runtime permission dialog, since current implementation does not give me any choice.
I cannot find any example of MRAID implementation or anything. MoPub requires MRAID related view and activity to be listed in AndroidManifest.
Manifest:
<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" />
MainActivity
public class MainActivity extends BaseActivity implements MoPubInterstitial.InterstitialAdListener, MoPubView.BannerAdListener, {
private void initAds() {
moPubView.setBannerAdListener(this);
moPubView.setAdUnitId(AD_UNIT);
moPubView.loadAd();
mInterstitial = new MoPubInterstitial(this,INTERSTITIAL_ADUNIT);
mInterstitial.setInterstitialAdListener(this);
mInterstitial.load();
}
@Override
public void onBannerLoaded(MoPubView banner) {
}
@Override
public void onBannerFailed(MoPubView banner, MoPubErrorCode errorCode) {
}
@Override
public void onBannerClicked(MoPubView banner) {
analytics.triggerEvent(BANNER_TAP);
}
@Override
public void onBannerExpanded(MoPubView banner) {
}
@Override
public void onBannerCollapsed(MoPubView banner) {
}
@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {
if (mInterstitial.isReady()) {
mInterstitial.show();
}
}
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
}
@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {
}
@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {
analytics.triggerEvent(EVENT.INTERSTITIAL_TAP);
}
@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {
}
}
Upvotes: 0
Views: 415