Follow

Adobe Air Native Extension Integration

1. The AerServ Platform

Download Here

The Adobe Air download contains:

  • doc: API file directory: doc/com/aerserv/sdk/ane/AerServSDK.html
  • lib: AerServExtension.ane
  • README: Prerequisite instructions
  • sample-app: Aerserv Adobe Air Sample apps for reference use.
Create Your App

2. Installing the library

Add AerServExtension.ane to your project library

Flash Professional CS6 and up:

  1. Create a new mobile project
  2. Choose File > Publish Settings...
  3. Select the wrench icon next to 'Script' for 'ActionScriptSettings'
  4. Select the Library Path tab
  5. Click "Browse for Native Extension (ANE) File" and select the lib/AerServExtension.ane file

Flash Builder 4.6 and up:

  1. Go to Project Properties
  2. Select Native Extensions under Actionscript Build Path
  3. Choose Add ANE... and navigate to lib/AerServExtension.ane
  4. Select Actionscript Build Packaging > Google Android or Apple iOS
  5. Select the Native Extensions tab, an click the Package check box next to the extension

3. Add Actionscript

For full code samples check out: sample-app/src/as/com/aerserv/sample/app.as

3.1. Import the library

import com.aerserv.sdk.ane.AerServSDK;

3.2. Create the AerServ Banner AdView


// Method call to load the banner with configured settings
AerServSDK.loadBanner(plc.text, 320, 50, AerServSDK.BANNER_BOTTOM,function(event: StatusEvent):void{
  // Events Callback Code goes here
});

3.3. Create the AerServ Interstitial


// Method call to load an interstitial
AerServSDK.loadInterstitial(plc.text,function(event: StatusEvent):void{
  // Handle Virtual Currency events
  if(event.code == AerServEvent.VC_READY || event.code == AerServEvent.VC_REWARDED){
    var vc: AerServVirtualCurrency = new AerServVirtualCurrency(event.level); 
    // Use vc.getName() and vc.getAmount() to access vc data
  }
});

//To use preload, include true as the final parameter to AerServSDK.loadInterstitial(..., true). The default value is false.

AerServSDK.loadInterstitial(plc.text,
 function(event: StatusEvent):void{
 statusLabel.htmlText += "<br>" + event.code;
 statusLabel.setTextFormat(format);
 }, ["foo1", "foo2"], true);

//Show Method Once preload event fired
AerServSDK.show();

3.4. Additional Android Steps

Update your Application Descriptor

  • You'll need AIR SDK v3.1 or higher
  • Include the extension in your Application Descriptor in your XML
  • Update the Android Manifest
!-- Required Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<!-- Required Activity -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_servic es_version" />
<activity android:name="com.aerserv.sdk.view.ASVastInterstitialActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
 
<activity android:name="com.aerserv.sdk.view.ASWebviewInterstitialActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />  
<activity android:name="com.aerserv.sdk.view.ASVpaidInterstitalActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> </application> </manifest>

If you wish to include 3rd party ad mediation:

<!-- Optional Activity -->
<activity android:name="com.google.android.gms.ads.AdActivity" 		
	android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

<activity
	android:name="com.vungle.publisher.FullScreenAdActivity"
	android:configChanges="keyboardHidden|orientation|screenSize" 	
	android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
 

<activity   
	android:name="com.jirbo.adcolony.AdColonyOverlay"
	android:configChanges="keyboardHidden|orientation|screenSize" 
	android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"     />
<activity   
	android:name="com.jirbo.adcolony.AdColonyFullscreen" 
	android:configChanges="keyboardHidden|orientation|screenSize" 
	android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"     />
<activity   
	android:name="com.jirbo.adcolony.AdColonyBrowser" 	
	android:configChanges="keyboardHidden|orientation|screenSize" 
	android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"     />

3.5. Virtual Currency Setup

  • Set up your VC name and amount here
  • Implement VC event listeners

You must pass the code event.level into the constructor of an AerServVirtualCurrency object in order to get the name and amount. This works with both the VC_READY and VC_REWARDED events.

The following code can be used to add virtual currency events to your interstitial button code:

if(event.code == AerServEvent.VC_READY || event.code == AerServEvent.VC_REWARDED){
	var vc: AerServVirtualCurrency = new AerServVirtualCurrency(event.level); 
	statusLabel.htmlText += " " + vc.getName() + " " + vc.getAmount(); 
}

4. Building Sample App

4.1. Installing the Sample App for Android

Requirements: npm

Sample app contain a make file you can use build the app by executing following command in terminal:

  • cd ../sample-app
  • make app-android 
  • install-android

4.2. Installing the Sample App for IOS

Requirements:

  • Make file
  • Gcc ( GNU Compiler Collection)
  • Xcode
  • Profile.mobileprovision file from developer.apple.com (placeholder provided in ios_keys dir for naming convension)
  • Cert.p12 (placeholder provided in ios_keys dir for naming convension)
  • Ios-deploy command

Sample app contain a make file you can use build the app by executing following command in terminal:

  • cd ../sample-app
  • ls ios_keys/

cert.p12   profiles.mobileprovision 

(replace with your IOS cert.p12 and profile.mobileprovision)

  • make app-ios (Make light SDK)
  • ios-deploy 
  • install-ios

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments