Search in sources :

Example 1 with SdkConfiguration

use of com.mopub.common.SdkConfiguration in project prebid-mobile-android by prebid.

the class RubiconRewardedVideoMoPubDemoActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);
    PrebidMobile.setPrebidServerHost(Host.RUBICON);
    PrebidMobile.setPrebidServerAccountId(Constants.PBS_ACCOUNT_ID_RUBICON);
    PrebidMobile.setStoredAuctionResponse(Constants.PBS_STORED_RESPONSE_VAST_RUBICON);
    VideoBaseAdUnit.Parameters parameters = new VideoBaseAdUnit.Parameters();
    parameters.setMimes(Arrays.asList("video/mp4"));
    parameters.setProtocols(Arrays.asList(Signals.Protocols.VAST_2_0));
    // parameters.setProtocols(Arrays.asList(new Signals.Protocols(2)));
    parameters.setPlaybackMethod(Arrays.asList(Signals.PlaybackMethod.AutoPlaySoundOff));
    // parameters.setPlaybackMethod(Arrays.asList(new Signals.PlaybackMethod(2)));
    RewardedVideoAdUnit adUnit = new RewardedVideoAdUnit("1001-1");
    adUnit.setParameters(parameters);
    this.adUnit = adUnit;
    SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder(Constants.MP_ADUNITID_REWARDED).build();
    MoPub.initializeSdk(this, sdkConfiguration, null);
    MoPubRewardedVideos.setRewardedVideoListener(this);
    final Map<String, String> keywordsMap = new HashMap<>();
    adUnit.fetchDemand(keywordsMap, new OnCompleteListener() {

        @Override
        public void onComplete(ResultCode resultCode) {
            MoPubRewardedVideoManager.RequestParameters parameters = new MoPubRewardedVideoManager.RequestParameters(Util.convertMapToMoPubKeywords(keywordsMap));
            MoPubRewardedVideos.loadRewardedVideo(Constants.MP_ADUNITID_REWARDED, parameters, (MediationSettings) null);
        }
    });
}
Also used : HashMap(java.util.HashMap) RewardedVideoAdUnit(org.prebid.mobile.RewardedVideoAdUnit) OnCompleteListener(org.prebid.mobile.OnCompleteListener) VideoBaseAdUnit(org.prebid.mobile.VideoBaseAdUnit) SdkConfiguration(com.mopub.common.SdkConfiguration) MediationSettings(com.mopub.common.MediationSettings) ResultCode(org.prebid.mobile.ResultCode) MoPubRewardedVideoManager(com.mopub.mobileads.MoPubRewardedVideoManager)

Example 2 with SdkConfiguration

use of com.mopub.common.SdkConfiguration in project prebid-mobile-android by prebid.

the class TestResultsActivity method initMoPub.

private void initMoPub(String adUnitId) {
    SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder(adUnitId).build();
    MoPub.initializeSdk(this, sdkConfiguration, this::runTests);
}
Also used : SdkConfiguration(com.mopub.common.SdkConfiguration)

Example 3 with SdkConfiguration

use of com.mopub.common.SdkConfiguration in project prebid-mobile-android by prebid.

the class XandrNativeInAppMoPubDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);
    SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("2674981035164b2db5ef4b4546bf3d49").withLogLevel(MoPubLog.LogLevel.DEBUG).build();
    MoPub.initializeSdk(this, sdkConfiguration, null);
    loadInAppNativeMopub();
}
Also used : SdkConfiguration(com.mopub.common.SdkConfiguration)

Example 4 with SdkConfiguration

use of com.mopub.common.SdkConfiguration in project prebid-mobile-android by prebid.

the class CustomApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // init MoPub SDK
    SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("a935eac11acd416f92640411234fbba6").build();
    MoPub.initializeSdk(this, sdkConfiguration, null);
    // set Prebid Mobile global Settings
    // region PrebidMobile API
    PrebidMobile.setShareGeoLocation(true);
    PrebidMobile.setApplicationContext(getApplicationContext());
    // endregion
    if (BuildConfig.DEBUG) {
        sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));
        this.registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {

            @Override
            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
                activity.getWindow().addFlags(FLAG_TURN_SCREEN_ON | FLAG_SHOW_WHEN_LOCKED | FLAG_KEEP_SCREEN_ON);
            }

            @Override
            public void onActivityStarted(Activity activity) {
            }

            @Override
            public void onActivityResumed(Activity activity) {
            }

            @Override
            public void onActivityPaused(Activity activity) {
            }

            @Override
            public void onActivityStopped(Activity activity) {
            }

            @Override
            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
            }

            @Override
            public void onActivityDestroyed(Activity activity) {
            }
        });
    }
}
Also used : Bundle(android.os.Bundle) Activity(android.app.Activity) SdkConfiguration(com.mopub.common.SdkConfiguration) Intent(android.content.Intent)

Aggregations

SdkConfiguration (com.mopub.common.SdkConfiguration)4 Activity (android.app.Activity)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 MediationSettings (com.mopub.common.MediationSettings)1 MoPubRewardedVideoManager (com.mopub.mobileads.MoPubRewardedVideoManager)1 HashMap (java.util.HashMap)1 OnCompleteListener (org.prebid.mobile.OnCompleteListener)1 ResultCode (org.prebid.mobile.ResultCode)1 RewardedVideoAdUnit (org.prebid.mobile.RewardedVideoAdUnit)1 VideoBaseAdUnit (org.prebid.mobile.VideoBaseAdUnit)1