Rewarded and Fullscreen
Rewarded and Fullscreen - Adobe Air
Before you begin!
Make sure that you have completed the Adobe Air Plugin installation before you begin integrating the Rewarded/Fullscreen video ad unit
Integrating the Rewarded/Fullscreen video ad unit
Step 1: Import the ad unit
Full-Screen:
import com.appnext.ads.fullscreen.FullScreenVideo;
Rewarded:
import com.appnext.ads.fullscreen.RewardedVideo;
Step 2: Set the placement id
Full-Screen:
var fullscreen_ad:FullScreenVideo = new FullScreenVideo(ADD_HERE_YOUR_PLACEMENT_ID);
Rewarded:
var rewarded_ad:RewardedVideo = new RewardedVideo(ADD_HERE_YOUR_PLACEMENT_ID);
Make sure to set your app's placementID in the constructor of this class
Step 3: Load the ad
You must load the ad before showing it.
Full-Screen:
fullscreen_ad.loadAd();
Rewarded:
rewarded_ad.loadAd();
In case the loadAd function was not called, the SDK will return an error - "ad not ready".
Step 4: Show the ad
Full-Screen:
if (fullscreen_ad.isAdLoaded()){
fullscreen_ad.showAd();
}else{
//continue...
}
Rewarded:
if (rewarded_ad.isAdLoaded()){
rewarded_ad.showAd();
}else{
//continue...
}
Step 5: Callbacks (optional)
In order to receive client-side events, import the following reference
import com.appnext.ads.events.AdEvent;
Receive events from the SDK:
Full-Screen Events:
Event for ad loaded
fullscreen_ad.addEventListener(AdEvent.AD_LOADED, adLoadedHandler);
function adLoadedHandler(event:AdEvent):void {
//process event here
}
Event for ad clicked
fullscreen_ad.addEventListener(AdEvent.AD_CLICKED, adClickedHandler);
function adClickedHandler(event:AdEvent):void {
//process event here
}
Event for ad closed
fullscreen_ad.addEventListener(AdEvent.AD_CLOSED, adClosedHandler);
function adClosedHandler(event:AdEvent):void {
//process event here
}
Event for ad error
fullscreen_ad.addEventListener(AdEvent.AD_ERROR, adErrorHandler);
function adErrorHandler(event:AdEvent):void {
//process event here
trace(event.message);
}
The following possible errors can be passed in the AdEvent.AD_ERROR handler:
NoInternetConnection;
NoPlacementID;
DownloadingResources;
AdNotReady;
PreparingViews;
LoadingAd;
NoAds;
FailedLoadingAds;
Example
interstitial_Ad.addEventListener(AdEvent.AD_ERROR, adErrorHandler);
function adErrorHandler(event:AdEvent):void {
switch (event.message) {
case AppnextError.NoAds:
trace("no ads");
break;
case AppnextError.NoInternetConnection:
trace("connection problem");
break;
default:
trace("other error");
break;
}
Event when the user saw the video until the end (video ended)
import com.appnext.ads.events.VideoAdEvent;
fullscreen_ad.addEventListener(VideoAdEvent.VIDEO_ENDED, videoEndedHandler);
function videoEndedHandler(event:VideoAdEvent):void {
//process event here
}
Rewarded Callbacks:
Event for ad loaded
rewarded_ad.addEventListener(AdEvent.AD_LOADED, adLoadedHandler);
function adLoadedHandler(event:AdEvent):void {
//process event here
}
Event for ad clicked
rewarded_ad.addEventListener(AdEvent.AD_CLICKED, adClickedHandler);
function adClickedHandler(event:AdEvent):void {
//process event here
}
Event for ad closed
rewarded_ad.addEventListener(AdEvent.AD_CLOSED, adClosedHandler);
function adClosedHandler(event:AdEvent):void {
//process event here
}
Event when the user saw the video until the end (video ended)
import com.appnext.ads.events.VideoAdEvent;
rewarded_ad.addEventListener(VideoAdEvent.VIDEO_ENDED, videoEndedHandler);
function videoEndedHandler(event:VideoAdEvent):void {
//process event here
}
Step 6: Configuring the Rewarded/Fullscreen video ad unit
By default, the SDK configuration will be loaded from Appnext's server. You can change the configuration directly by property or through the setter function.
Change to each configuration (Full-Screen / Rewarded) should be made separately.
Full-Screen:
import the following class:
import com.appnext.ads.fullscreen.RewardedConfig;
Define the Rewarded configuration instance:
var config:FullscreenConfig = new FullscreenConfig();
Rewarded:
import the following class:
import com.appnext.ads.fullscreen.RewardedConfig;
Define the Fullscreen configuration instance:
var config:RewardedConfig = new RewardedConfig();
List of configuration options:
Rewarded video mode (Android only)
Set the mode the rewarded ad unit will work in
- "multi" - with pre-roll video selection screen (Default)
- "normal" - without pre-roll video selection screen
Rewarded Multi Screen Timer Length (Android only)
When “multi” mode is on, this property sets the number of seconds to make a video selection. The property can accept values from 1 to 20. Default value is 8 seconds.
Roll screen caption (Android only)
The number of seconds that the google play text caption is showing. The caption is shown to the user after clicking the Call-to-action button. The property can accept values from 1 to 20. The default value is 3 seconds. Entering -1 will make the caption visible until the video finish to play
Button Text (iOS only)
The install button's text (default is "Install")
Button Color (iOS only
The install button's color - a 6 hex chars starting with # (default is "#ffffff")
Skip Button Text
Set a custom text for the "skip" button (default is "Skip)
Category
Set preferred ad categories
Install Postback
Postback parameters that will be posted to your server after user installed an app (make sure to encode the values)
Mute Video
Mute the video which is played in the Interstitial (default is "false")
- true
- false
Progress Type (iOS only)
Choose progress type, or hide it (default is "FullscreenVideo.PROGRESS_CLOCK")
- FullScreenVideo.PROGRESS_CLOCK
- FullScreenVideo.PROGRESS_BAR
- FullScreenVideo.PROGRESS_NONE
Progress Color (iOS only)
Set progress bar / clock color. 6 characters hex starting with # (default is #ffffff)
Video Length (Full-Screen and Rewarded):
Set video length - 15 or 30 seconds long (default is VIDEO_LENGTH_DEFAULT)
- FullScreenVideo.VIDEO_LENGTH_SHORT - Up to 15 seconds long videos
- FullScreenVideo.VIDEO_LENGTH_LONG - 20-60 seconds long videos
- FullScreenVideo.VIDEO_LENGTH_DEFAULT - Appnext's algorithm priority. Any available video campaign will be served
Please note that if no SHORT type length videos are available, long videos will be served
Orientation:
Set the preferred orientation if both landscape and portrait are supported by the application (default is ORIENTATION_DEFAULT)
- FullScreenVideo.ORIENTATION_DEFAULT
- FullScreenVideo.ORIENTATION_LANDSCAPE
- FullScreenVideo.ORIENTATION_PORTRAIT
- FullScreenVideo.ORIENTATION_AUTO
Auto Play Video
Set video auto-play (default is "true")
- true
- false
Examples:
Full-Screen config example:
var config:FullscreenConfig = new FullscreenConfig();
config.setButtonText("Install");
config.setButtonColor("#ffffff"));
config.setCategories("category1,category2");
config.setPostback("postback");
config.setProgressType(FullScreenVideo.PROGRESS_CLOCK);
config.setProgressColor("#ffffff");
config.setVideoLength(FullScreenVideo.VIDEO_LENGTH_DEFAULT);
// you can alternatively set the property directly:
config.buttonText = "Install";
config.buttonColor = "#ffffff";
config.categories = "category1,category2";
config.postback = "postback";
config.progressType = FullScreenVideo.PROGRESS_CLOCK;
config.progressColor = "#ffffff";
config.videoLength = FullScreenVideo.VIDEO_LENGTH_DEFAULT;
var fullscreen_ad:FullScreenVideo = new FullScreenVideo(placementID, config);
Rewarded config example:
var config:RewardedConfig = new RewardedConfig();
config.setMode("multi");
config.setCategories("category1,category2");
config.setPostback("postback");
config.setProgressColor("#ffffff");
config.setMultiTimerLength(10);
config.setRollScreenCaptionTime(-1);
config.categories = "category1,category2";
config.postback = "postback";
config.videoLength = RewardedConfig.VIDEO_LENGTH_DEFAULT;
var rewarded_ad:Rewarded = new RewardedVideo(placementID, config);
Using Setters:
//Fullscreen:
FullScreenVideo fullscreen_ad = new FullScreenVideo(this, placementID);
fullscreen_ad.setButtonText("Install");
fullscreen_ad.setButtonColor("#6AB344"));
fullscreen_ad.setCategories("category1,category2");
fullscreen_ad.setPostback("postback");
fullscreen_ad.setProgressType(FullScreenVideo.PROGRESS_CLOCK);
fullscreen_ad.setProgressColor("#ffffff");
fullscreen_ad.setVideoLength(FullScreenVideo.VIDEO_LENGTH_DEFAULT);
fullscreen_ad.setOrientation(FullScreenVideo.ORIENTATION_DEFAULT);
//Rewarded:
RewardedVideo rewarded_ad = new RewardedVideo(this, placementID);
rewarded_ad.setButtonText("Install");
rewarded_ad.setButtonColor("#6AB344"));
rewarded_ad.setCategories("category1,category2");
rewarded_ad.setPostback("postback");
rewarded_ad.setProgressType(RewardedVideo.PROGRESS_CLOCK);
rewarded_ad.setProgressColor("#ffffff");
rewarded_ad.setVideoLength(RewardedVideo.VIDEO_LENGTH_DEFAULT);
rewarded_ad.setOrientation(RewardedVideo.ORIENTATION_DEFAULT);
Server-side postback - Rewarded Video
You can choose to receive server-side postbacks whenever a user finishes watching a video ("video ended" event).
The "video ended" event will serve as a trigger for the reward action.
Please note that in addition to configuring the postback in this integration process, you will also need to set your postback URL on the Appnext Self-Service platform (under the "Apps" page / app "Settings & Placements" / "Advanced Settings').
In order to receive the server-side postback on the "video ended" event, call the following functions before showing the ad:
Transaction ID - make sure to set a unique transaction ID per ad view
rewarded_ad.transactionId = "TransactionId";
User ID - pass the User ID so you will know which user to reward
rewarded_ad.userId = "UserId";
Currency Type - type of reward (life / credit / points)
rewarded_ad.typeCurrency = "TypeCurrency";
Amount - the amount of currency that was rewarded
rewarded_ad.amountRewarded = "Amount";
Custom Parameters - pass any custom value / data
rewarded_ad.customParameter = "CustomParameter";
- Make sure to encode all values.
- Passing at least one value is mandatory.
App Categories
Android: 1. Action 2. Adventure 3. Arcade 4. Arcade & Action 5. Board 6. Books & Reference 7. Brain & Puzzle 8. Business 9. Card 10. Cards & Casino 11. Casino 12. Casual 13. Comics 14. Communications 15. Education 16. Educational 17. Entertainment 18. Family 19. Finance 20. Health & Fitness 21. Libraries & Demo 22. Lifestyle 23. Live Wallpaper 24. Media & Video 25. Medical 26. Music 27. Music & Audio 28. News & Magazines | 29. Personalization 30. Photography 31. Productivity 32. Puzzle 33. Racing 34. Role Playing 35. Shopping 36. Simulation 37. Social 38. Sports 39. Sports Games 40. Strategy 41. Tools 42. Travel & Local 43. Trivia 44. Weather 45. Word *iOS:** 1. Action 2. Adventure 3. Arcade 4. Board 5. Books 6. Business 7. Card 8. Casino 9. Catalogs 10. Dice | 11. Education 12. Educational 13. Entertainment 14. Family 15. Finance 16. Food & Drink 17. Graphics & Design 18. Health & Fitness 19. Kids 20. Lifestyle 21. Medical 22. Music 23. Navigation 24. News 25. Photo & Video 26. Productivity 27. Puzzle 28. Racing 29. Reference 30. Role Playing 31. Simulation 32. Social Networking 33. Sports 34. Strategy 35. Travel 36. Trivia 37. Utilities 38. Weather |
Make sure to encode (%20) categories with more than 1 word, example: Travel%20%26%20Local
Integration Support
Integration Support
Should you have any problems integrating the product, log a ticket with us by emailing [email protected].
Updated almost 7 years ago