Adobe Air 8.15.0 - The Quick Start Guide for the Fyber Adobe Air Native Extension

Overview

This document provides an overview of the most efficient method of getting the Adobe Air Native Extension SDK integrated into your application.

Retrieving the appID
Adding Activities for Displaying Ads
Starting the SDK
Adding Ad formats
Requesting the Ads
Rewarding the User
Adding Pre-caching
Using an ExceptionEvent handler
Using example code

Retrieving the appID

The appId and the securityToken are required to start the SDK. If no userId is provided, a unique one will be automatically generated during the first app launch.

For Android, the following lines should be added to your Adobe AIR Application Descriptor File Template of your App (…-app.xml) which includes the Manifest. The Manifest data must also include the following permissions:

<uses-permission android:name="android.permission.INTERNET"/>
	
<!-- Used to avoid sending a request if there is no connectivity. -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
	
<!-- Used for the precaching service -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Adding Activities for Displaying Ads

For Android, make sure that you add the following Activities to your Manifest for the Fyber products you wish to use:

Offer Wall

<!-- Fyber OfferWall Activity -->
<activity android:name="com.sponsorpay.publisher.ofw.SPOfferWallActivity"
	android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
	android:screenOrientation="sensor" />

Rewarded Video

<!-- Fyber Rewarded Video Activity -->
<activity android:name="com.fyber.sdk.wrapper.FYBRewardedVideoAirActivity"
	android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
	android:hardwareAccelerated="true" />

Interstitial

<!-- Fyber Interstitial Activity -->
<activity android:name="com.sponsorpay.publisher.interstitial.SPInterstitialActivity"
	android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
	android:hardwareAccelerated="true" />

Fyber Wrapper

<!-- Fyber Wrapper Activity -->
<activity android:name="com.fyber.sdk.wrapper.FYBWrapperActivity"
	android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
	android:hardwareAccelerated="true" />

Pre-caching service

<!-- Fyber Pre-caching service -->
<service android:name="com.sponsorpay.publisher.mbe.player.caching.SPCacheVideoDownloadService" />

Google Play Services

<!-- Google Play -->
<meta-data android:name="com.google.android.gms.version"
	android:value="@integer/google_play_services_version" />

Please note: If you are using Google Play Services, please make sure to import the playservices-<version>.ane file into your project.

Starting the SDK

You must first start the Fyber SDK before being able to use any Fyber products:

import com.fyber.FyberSdk;

[...]

credentialsToken = FyberSdk.instance.start(appId, token, userId);

Adding Ad formats

Requesting Ads

You can request video ads or interstitial ads with the Fyber Adobe Air Native Extension.

Requesting Rewarded Video Ads

FyberSdk.instance.requestRewardedVideoAds(credentialsToken, currencyName, isVCSQuery, currencyId, placementId);

You can then check the status of the requested Rewarded Video in a listener:

FyberSdk.instance.addEventListener(RewardedVideoEvent.STATUS, onFyberRewardedVideoEvent);

[...]

private function onFyberRewardedVideoEvent(e:RewardedVideoEvent):void {
	switch(e.status) {
		case RewardedVideoEvent.STARTED:
			[...]
			break;
		case RewardedVideoEvent.CLOSE_FINISHED:
			[...]
			break;
		case RewardedVideoEvent.CLOSE_ABORTED:
			[...]
			break;
		case RewardedVideoEvent.AVAILABLE:
			[...]
			break;
		case RewardedVideoEvent.UNAVAILABLE:
			[...]
			break;
		case RewardedVideoEvent.ERROR:
			// e.message = A description of the error
			[...]
			break;
	}
}

Requesting Interstitials

FyberSdk.instance.requestInterstitialAds(credentialsToken, placementId);

You can check the status of the requested Interstitial in a listener:

FyberSdk.instance.addEventListener(InterstitialEvent.STATUS, onFyberInterstitialEvent);

[...]

private function onFyberInterstitialEvent(e:InterstitialEvent):void {
	switch(e.status) {
		case InterstitialEvent.DISMISS_REASON_UNKNOWN:
			[...]
			break;
		case InterstitialEvent.DISMISS_REASON_USER_CLICKED_AD:
			[...]
			break;
		case InterstitialEvent.DISMISS_REASON_USER_CLOSED_AD:
			[...]
			break;
		case InterstitialEvent.ERROR:
			// e.message = A description of the error
			[...]
			break;
		case InterstitialEvent.AVAILABLE:
			[...]
			break;
		case InterstitialEvent.UNAVAILABLE:
			[...]
			break;
	}
}

Requesting the Ads

After you have added the information to the Manifest File you are able to request the videos. The process is different between the three products.

Showing the Rewarded Video

To show the Rewarded Video after it was requested call:

FyberSdk.instance.showRewardedVideoAd();

Showing an Interstitial

To show an Interstitial after it was requested call:

FyberSdk.instance.showInterstitialAds();

Showing the Offer Wall

To launch the Offer Wall call:

import com.fyber.FyberSdk;

[...]

FyberSdk.instance.launchOfferWall(credentialsToken, currencyName, placementId);

To receive an Offer Wall result, you can register as an event listener in the SDK:

import com.fyber.air.events.OfferwallEvent;

[...]

FyberSdk.instance.addEventListener(OfferwallEvent.STATUS, onFyberOfferWallEvent);

[...]

private function onFyberOfferWallEvent(e:OfferwallEvent):void {
	[...]
}

Rewarding the User

If you have your own currency service and want to receive serverside postbacks, change your settings on the publisher control panel to reflect this.

Your application will automatically take advantage of Fyber’s virtual currency hosting. To reward your users after they complete an offer or finish watching a Rewarded Video call the VirtualCurrencyRequester.

First register a VCS Listener:

FyberSdk.instance.addEventListener(VCSEvent.STATUS, onFyberVCSEvent);

Now you can evaluate the VCSEvent in the event handler:

private function onFyberVCSEvent(e:VCSEvent):void {
	switch(e.status) {
		case VCSEvent.SUCCESS:
			// e.currencyName = Name of the currency awarded
			// e.currencyId = ID of the currency awarded (as specified in the Fyber Dashboard)
			// e.deltaOfCoins = Amount of coins to be given to the user
			// e.transactionId = The latest transaction ID
			[...]
			break;
		case VCSEvent.ERROR:
			// e.errorMessage = A description of the error
			// e.errorType = A detail of what kind of error
			// e.errorCode = An error code
			[...]
			break;
	}
}

Then perform the following request:

FyberSdk.instance.requestNewCoins(credentialsToken, currencyName, currencyId);

Adding Pre-caching

When you start the Adobe Air SDK, pre-caching will automatically start on all integrated mediation adapters. If you want to start or stop pre-caching at a later time, use the videoDownloadPause() method and add the following line (true or false):

FyberSdk.instance.videoDownloadPause(true); // this call will pause Video Pre-caching

Using an ExceptionEvent handler

You can use this ExceptionEvent handler example to show the status message of the ExceptionEvent:

import com.fyber.air.events.ExceptionEvent;

[...]

FyberSdk.instance.addEventListener(ExceptionEvent.STATUS, onFyberExceptionEvent);

[...]

private function onFyberExceptionEvent(e:ExceptionEvent):void {
	// e.message = A description of the error
}