Follow

Basic4Android: Getting Started

Prerequisites: It is assumed that you have already configured the Basic4android development environment and all of its prerequisites including Java 7+.

1. The AerServ Platform

Download Here

Overview:

Aerserv is a free mobile SSP and monetization platform that empowers mobile publishers with a superior technology platform, supercharges their ad revenue through mobile video, and supports them with unrivaled customer service for a triple-win.

Ad Types:

aerBanner (banner ad):

The traditional banner is the most widely used ad format on mobile devices. With multiple banner ad sizes, AerServ makes it easy to monetize your mobile app with banners.

aerWall (interstitial ad):

Our most popular and powerful ad unit. The aerWall interstitial combines multiple ad units into one to pack a powerful punch. Our Smart Optimizer system with optimize between static interstitials, rich media interstitials, video interstitials and more rolled up in one. Don't waste your time trafficking - let aerWall do the hard work and bring you industry leading CPMs!

2. SDK Folder Structure

SDK Folder Structure
  1. B4aAerservSample: Aerserv Sample App
  2. lib: Aerserv Plugin folder
  3. README: Documentation
  4. Version: Plugin version

3. Update Android Manifest

Within the Basic4Android IDE navigate to: Project > Manifest Editor and add the following:


'AerManifest file entries 
AddManifestText(
<uses-sdk  
	android:minSdkVersion="10"  
	android:targetSdkVersion="20"/>
<supports-screens  
	android:largeScreens="true" 
	android:normalScreens="true" 
	android:smallScreens="true" 
	android:anyDensity="true"/>

<!-- Required Permissions -->
<uses-permission  android:name="android.permission.INTERNET"  />
<uses-permission  android:name="android.permission.ACCESS_NETWORK_STATE"  />
<uses-permission  android:name="android.permission.ACCESS_COARSE_LOCATION"  />
<uses-permission  android:name="android.permission.ACCESS_FINE_LOCATION"  />
<uses-permission  android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"  />
<uses-permission  android:name="android.permission.READ_PHONE_STATE"  />
<uses-permission  android:name="android.permission.WRITE_EXTERNAL_STORAGE"  />
<uses-permission  android:name="android.permission.ACCESS_FINE_LOCATION"  />

<!-- Optional Permissions -->
<uses-permission  android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission  android:name="android.permission.VIBRATE"/>
)
 
'Please make sure to initiate AerServ SDK Ad requests in your 
AddApplicationText(
<!-- Required Activity -->
<activity
  android:name="com.aerserv.sdk.view.ASVastInterstitialActivity"
  android:theme="@android:style/Theme.Translucent"   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" />

	
)
SetApplicationAttribute(android:icon,"@drawable/icon") 
SetApplicationAttribute(android:label,  "$LABEL$")
'End of AerServ manifest file entries.

4. Integration Aerserv B4A Plugin

  1. Copy AerServ.jar and AerServ.xml from target/android-sdk-basic4android-plugin/lib to the Basic4Android ./Libraries folder.
  2. Open the Libraries Manager tab and Select Aerserv
Integration Aerserv B4A Plugin

5. Ad Calls

5.1. Banner Ad

To display banners, do the following (replace test PLC with your PLC):

'Instantiate Aerserv banner ad
Dim aerservBanner As AerServSDKBannerAdCall

'Banner ad on top
aerservBanner.loadBannerAdOnTop("1000308")

'Banner ad on bottom
aerservBanner.loadBannerAdOnBottom("1000308")

TEST PLCS

  1. PLC: 1000308 Ad unit: 300x50
  2. PLC: 1000835 Ad unit: 300x250
  3. PLC: 1000834 Ad unit: 720x90

5.2. Interstitial Ad

Loading interstitial ads is a two step process. First preload it as follows (replace test PLC with your PLC):

'Instantiate Aerserv interstitial ad
Dim aerservInterstitial As AerServSDKOfferWallAdCall

'Interstitial/offerwall/Video Ad
aerservInterstitial.loadInterstitialAd("1000741")

'When preload is ready, you will get a call back. 
'Define the callback subroutine as follows to display the ad:
Sub AerServ_InterstitialPreloadReady
  aerservInterstitial.displayInterstitialAd()
End Sub

The above loads ads with no keywords and default timeout. To specify them yourself, use the corresponding *WithOptions methods (e.g. loadInterstitialAdWithOptions). They all take List<String> keyword parameter, and the Integer timeout (in milliseconds) parameter to override these optional parameters.

Test PLC

  • PLC: 1000741 Ad unit: aerVideo

5.3. Implement Event Listeners

The following events can be fired by AerServ SDK (note some are

fired by banner or interstitial ads only, and some by both):

  • VIDEO_START
  • VIDEO_25
  • VIDEO_50
  • VIDEO_75
  • VIDEO_COMPLETED
  • PRELOAD_READY
  • AD_LOADED
  • AD_IMPRESSION
  • AD_CLICKED
  • AD_COMPLETED
  • AD_DISMISSED
  • AD_FAILED
  • VC_READY
  • VC_REWARDED
  • MRAID_READY
  • MRAID_CREATE_CALENDAR_EVENT
  • MRAID_CLOSE
  • MRAID_EXPAND
  • MRAID_OPEN
  • MRAID_PLAY_VIDEO
  • MRAID_RESIZE
  • MRAID_STORE_PICTURE

 

To capture the event, define subroutines with the following names:

AerServ_Banner_<event_name>
AerServ_Interstitial_<event_name>

E.g.:
AerServ_Banner_Ad_Loaded
AerServ_Interstitial_Ad_Loaded

If this callback subroutine exists, AerServ SDK will call it. If not, the event is ignored. Please make sure the parameters match: AD_FAILED event takes a single String parameter for error message, but all other events do not take parameters.

6. Ad Mediation

For ad mediation, please use Aerserv-max.jar and Aerserv-max.xml instead of Aerserv.* counterparts.

6.1. AdMob

Edit platforms/android/build.gradle and modify the content as follows:

repositories {
	mavenCentral()
	flatDir {
		dirs 'libs'
	}
}
dependencies {
	compile fileTree(dir: 'libs', include: '*.jar')
	compile(name: 'google-play-services_lib', ext: 'aar')
	...
}

Add the following to /platforms/android/AndroidManifest.xml

< meta-data 
	android:name="com.google.android.gms.version"
	android:value="5089000"/>

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

6.2. AdColony

The following must be included in the AddApplicationText portion of the Manifest Editor

<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"/>

6.3. Vungle

The following must be included in the AddApplicationText portion of the Manifest Editor

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

7. Launching the App

  1. Please follow instructions in Setup section of this document to copy Aerserv.jar and Aerserv.xml to the Basic4Android Libraries folder.
  2. Then go to target/android-sdk-basic4android-plugin/B4aAerServSample and open "First B4A.b4a" file. Run the app.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk