VMAX SDK initialization

Now it’s not compulsory to use initVmaxSdk() api of VMAXPlugin i.e. VMAXPlugin.initVmaxSdk() for sdk initialization.
If you are integrating Rewarded interstitial then only it is mandatory to call VMAXPlugin.initWithRewardedInterstitial(string accountKey) api

Below is the code snippet for the same

1

2

3

4

5

6

7

8

9

VMAXPlugin.initWithRewardedInterstitial("accountKey");

VMAXPlugin.registerVmaxAdRewardListener();

voidonAdReward(stringreward)

{

Debug.Log("onAdReward : "+reward);

}

Register reward delegate

To Register above delegate for this ad format, It is required to call below api before caching the ad

1

VMAXPlugin.registerVmaxAdRewardListener();

Unregister reward delegate

To Unregister above delegate for this ad format, It is recommended to call this api in onDestroy() event of activity

1

VMAXPlugin.unregisterVmaxAdRewardListener();

Callbacks

Callbacks has been completely modified

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

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

/*Removed

public void adViewDidLoadAd(string requestCode) {}

public void adViewDidCacheAd (string requestCode) {}

Use onAdReady: instead

Called when an ad is loaded via invocation of loadAd()/cacheAd() API's.

loadAd() will show the ad immediately whereas cacheAd readies it &

requires showAd() to show*/

publicvoidonAdReady(stringadResponse){}

/*Removed

public void didFailedToLoadAd(string requestCode) {}

public void didFailedToCacheAd(string unusedMessae) {}

Use onAdError: instead

Called when the ad view fails to load an ad */

publicvoidonAdError(stringerrorResponse){}

/*Removed

public void willDismissAd(string requestCode) {}

Use onAdDismissed: instead

Called when an ad is about to be unloaded from the view */

publicvoidonAdDismissed(stringrequestCode){}

/*Removed

public void onVideoView(string requestCode) {}

Use onAdEnd: instead

Called when video ad viewing is completed */

publicvoidonAdEnd(stringresponse){}

/*Removed

public void didInteractWithAd(string unusedMessae) {}

Use onAdInteracted: instead

Called when user interacts with an ad via click */

publicvoidonAdInteracted(stringrequestCode){}

/*Removed

public void willPresentAd(string unusedMessae) {}

Use onAdStarted: instead

Called when an ad is about to be presented in the view */

publicvoidonAdStarted(stringrequestCode){}

/*Removed

public void willLeaveApp(string unusedMessae) {}

Use onAdLeftApplication: instead

Called when an ad click by user will open another app, sending the current */

publicvoidonAdLeftApplication(stringrequestCode){}

/*Called when an ad view transitions to an expanded state

Example: On clicking a banner, if an interstitial is displayed */

publicvoidonAdExpand(stringrequestCode){}

//Called when an ad view transitions back to a normal state.

publicvoidonAdCollapsed(stringrequestCode){}

Note: For callbacks like onAdReady, onAdError and onAdEnd you can split the callback parameter with ‘|’ character and make use of requestCode at split index 0. If you are using multiple objects of VMAXPlugin, utilize the request code so as to differentiate callback is coming for which object

Ad States

Corresponding with the listener as mentioned above, for SDK version 3.6.1 onwards you can check for the ad state which now will be set to one of the following possible values depending on the ad lifecycle:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

publicenumAdState{

STATE_AD_NOT_REQUESTED,

STATE_AD_READY,

STATE_AD_ERROR,

STATE_AD_STARTED,

STATE_AD_END,

STATE_AD_DISMISSED,

STATE_AD_EXPAND,

STATE_AD_COLLAPSED,

STATE_AD_PAUSED,

STATE_AD_RESUMED,

STATE_AD_INTERACTED,

STATE_AD_INTURRUPTED

}

You can query for the ad state by using the getAdState api on the adview as illustrated in the example below:

1

2

3

if(vmaxPlugin.getAdState().Equals("STATE_AD_READY"))

vmaxPlugin.showAd();

SetAdScale

You can now set the scale for billboard ads

1

2

3

4

5

/*If you want to scale the ad to other than standard billboard size(300x250) you can make use of

following api. The adscale value should be set in between 50 to 150. In most of the cases you can

ignore this*/

vmaxPlugin.setAdScale(50);//this will scale down the ad upto 50%

Ad Error

You can query for the error code, description and title of the error.Below are the error states along with its code.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

publicinterfaceAdError{

StringERROR_NOFILL="1001";

StringERROR_ADREQUEST_NOT_ALLOWED="1002";

StringERROR_MANIFEST_ENTRY_MISSING="1003";

StringERROR_TIMEOUT="1004";

StringERROR_INTERNAL_SERVER="1005";

StringERROR_SDK_INITIALIZATION="1006";

StringERROR_MISMATCHUX_OR_MARKUP="1007";

StringERROR_NETWORK_ERROR="1008";

StringERROR_MANDATORY_PARAM_MISSING="1009";

StringERROR_RENDITION_ERROR="1010";

StringERROR_PARSING="1011";

StringERROR_UNKNOWN="1012";

StringERROR_INVALID_REQUEST_ARGUMENTS="1013";

StringERROR_AD_EXPIRED="1014";

}

Error handling

Below callback will help to handle errors gracefully

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

// example usage

publicvoidonAdError(stringerrorResponse){

Debug.Log(" onAdError "+errorResponse);

if(!string.IsNullOrEmpty(errorResponse))

{

string[]errorDetails=errorResponse.Split('|');

if(errorDetails!=null)

{

Debug.Log("RequestCode: "+errorDetails[0]);

Debug.Log("Error Code: "+errorDetails[1]);

Debug.Log("Error Title: "+errorDetails[2]);

Debug.Log("Error Description: "+errorDetails[3]);

}

}

}

Ad Partner

This is helpful in identifying ad sources during ad delivery as well as erroneous situations. You can query for the partner name and partner SDK version through the adPartner property on VMaxAdView. Below is the list of Vmax supported partners.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

publicinterfaceAdPartnerKeys{

StringAD_PARTNER_ADMOB="AdMob";

StringAD_PARTNER_ADX="Adx";

StringAD_PARTNER_FACEBOOK="FaceBook";

StringAD_PARTNER_INMOBI="InMobi";

StringAD_PARTNER_FLURRY="Flurry";

StringAD_PARTNER_VUNGLE="Vungle";

StringAD_PARTNER_UNITYADS="UnityAds";

StringAD_PARTNER_POKKT="Pokkt";

StringAD_PARTNER_ADCOLONY="AdColony";

StringAD_PARTNER_TAPJOY="TapJoy";

StringAD_PARTNER_CHARTBOOST="ChartBoost";

StringAD_PARTNER_MILLENNIALMEDIA="MillennialMedia";

StringAD_PARTNER_GOOGLEIMA="GoogleIMA";

}

To Fetch the partner specific information, use the snippet given below:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

// example usage

publicvoidonAdReady(stringadResponse){

if(!string.IsNullOrEmpty(vmaxPlugin.getVmaxAdPartner()))

{

string[]partnerDetails=vmaxPlugin.getVmaxAdPartner().Split('|');

if(partnerDetails!=null)

{

Log.d("vmax","PartnerName "+partnerDetails[0]);

Log.d("vmax","PartnerVersion "+partnerDetails[1]);

}

}

}

UX for Billboard ads

3.6.1 now has the UX type UX_BILLBOARD for requesting billboard ads. UX_INLINE_DISPLAY is now removed.