Requesting Incent-based Ads – Android SDK

ขออภัยรายการนี้จะใช้ได้เฉพาะในภาษาอังกฤษ English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

It is recommended to use the cacheAd() and showAd() APIs for Rewarded Interstitial Ads.
For your reference purpose, We have created VMAX Sample App for Rewarded Video adspot. This app is open source and uploaded on Github where you can download and read example code for requesting Rewarded Video Ads

To show rewarded video ad

Passing Custom Data

The VMAX SDK allows you to pass extra data that is then available in a postback URL.

1

2

3

4

HashMap<String,String>customData=newHashMap<>();

customData.put("key1","value1");

customData.put("key2","value2");

vmaxAdView.setCustomData(customData);

Visit the VMAX Control Panel and enter the postback URL in Settings >> Apps and Adspots >> Rewarded Video Adspots. Once you define the key value pairs here, and configure the postback URL, you will get these keys and values as additional URL parameters on your server.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

//Make sure to handle Activity Life cycle callbacks with VmaxAdView

@Override

protectedvoidonPause(){

if(vmaxAdView!=null){

vmaxAdView.onPause();

}

super.onPause();

}

@Override

protectedvoidonResume(){

if(vmaxAdView!=null){

vmaxAdView.onResume();

}

super.onResume();

}

@Override

protectedvoidonDestroy(){

if(vmaxAdView!=null){

vmaxAdView.onDestroy();

}

super.onDestroy();

}

@Override

publicvoidfinish(){

if(vmaxAdView!=null){

vmaxAdView.finish();

}

super.finish();

}

@Override

publicvoidonBackPressed(){

if(vmaxAdView!=null){

vmaxAdView.onBackPressed();

}

super.onBackPressed();

}

Advanced

VMAX allows you to cache an interstitial ad in one Activity and show it in a different Activity.