Mobvista_Reward(English) - mobvistateam/Android_SDK_7.6.0 GitHub Wiki

##Access Reward advertising:

  • 1.Import the following jar to the project libs
 mobvista_reward.jar
 applovin-sdk-6.1.5.jar
 gson-2.3.1.jar(Because NativeX need, Mobvista SDK is not required)
 NativeXMonetizationSDK_v5.5.6.1.jar
  • 2.AndroidManifest.xml Add the following
 <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <!-- Polymerization appLovin Please add this content -->
        <meta-data
            android:name="applovin.sdk.key"
            android:value="HmrZmGOS5KNRGvmbOGt-cc6o2hvL4KeL5TwrkIIqdfFvZ0UyGMxtz1f_iTLnu-7-S1pBK5_ymFrJFKGWgBNeD1" />

        <activity
            android:name="com.nativex.videoplayer.VideoActivity"
            android:configChanges="orientation|screenSize" />
        <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
        <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
        <!-- NativeX Please add the following -->
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode"
            android:theme="@android:style/Theme.Translucent" />
        <activity
            android:name="com.nativex.monetization.activities.InterstitialActivity"
            android:configChanges="orientation|screenSize"
            android:hardwareAccelerated="true"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
        <activity
            android:name="com.nativex.videoplayer.VideoActivity"
            android:configChanges="orientation|screenSize" />
  • 3.Make sure SDK is initialized
  • 4.create MVRewardVideoHandler
   MVRewardVideoHandler mMvRewardVideoHandler = new MVRewardVideoHandler(
				this, UNIT_ID);

			// User to monitor advertising callback
		mMvRewardVideoHandler.setRewardVideoListener(new RewardVideoListener() {
			
			@Override
			public void onVideoLoadSuccess() {
				Log.e(TAG, "onVideoLoadSuccess");
			}

			@Override
			public void onVideoLoadFail() {
				Log.e(TAG, "onVideoLoadFail");
			}

			@Override
			public void onShowFail(String errorMsg) {
				Log.e(TAG, "onShowFail=" + errorMsg);
			}


			@Override
			public void onAdShow() {
				Log.e(TAG, "onAdShow");
			}

			@Override
			public void onAdClose(boolean isCompleteView, String RewardName,
					float RewardAmout) {
				Log.e(TAG, "reward info :" + "RewardName:" + RewardName
						+ "RewardAmout:" + RewardAmout);
				//demo custom dialog
				showDialog(RewardName, RewardAmout);
			}
		});
  • 5.MVRewardVideoHandler There are three interfaces
                //pre loading
			mMvRewardVideoHandler.load();
                //Whether it can play
			if (mMvRewardVideoHandler.isReady()) {
				//Display ads
				mMvRewardVideoHandler.show(REWARD_ID);
			}