AdFalcon Android SDK 2.1.4 Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group



Similar documents
Mocean Android SDK Developer Guide

ADITION Android Ad SDK Integration Guide for App Developers

PubMatic Android SDK. Developer Guide. For Android SDK Version 4.3.5

Advertiser Campaign SDK Your How-to Guide

Mobile App Sensor Documentation (English Version)

AdFalcon Mobile Web API Integration Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Introduction to NaviGenie SDK Client API for Android

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

KomliMobile Android SDK

How to develop your own app

Login with Amazon Getting Started Guide for Android. Version 2.0

Affdex SDK for Android. Developer Guide For SDK version 1.0

Mobile Application Development

An Android-based Instant Message Application

Android Development. Marc Mc Loughlin

IOIO for Android Beginners Guide Introduction

ID TECH UniMag Android SDK User Manual

MMI 2: Mobile Human- Computer Interaction Android

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

TUTORIAL. BUILDING A SIMPLE MAPPING APPLICATION

Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources. Recap: TinyOS. Recap: J2ME Framework

Android For Java Developers. Marko Gargenta Marakana

AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Overview. About Interstitial Ads: About Banner Ads: About Offer-Wall Ads: ADAttract Account & ID

Presenting Android Development in the CS Curriculum

Creating a List UI with Android. Michele Schimd

Developer Guide. Android Printing Framework. ISB Vietnam Co., Ltd. (IVC) Page i

TomTom PRO 82xx PRO.connect developer guide

Android Services. Android. Victor Matos

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Chapter 2 Getting Started

WEARIT DEVELOPER DOCUMENTATION 0.2 preliminary release July 20 th, 2013

Measuring The End-to-End Value Of Your App. Neil Rhodes: Tech Lead, Mobile Analytics Nick Mihailovski: Developer Programs Engineer

Android app development course

IBM Tealeaf CX Mobile Android Logging Framework Version 9 Release 0.1 December 4, IBM Tealeaf CX Mobile Android Logging Framework Guide

Frameworks & Android. Programmeertechnieken, Tim Cocx

Android Basics. Xin Yang

Developing Android Apps: Part 1

Android Introduction. Hello Mihail L. Sichitiu 1

HERE SDK for Android. Developer's Guide. Online Version 2.1

Developing Android Applications: Case Study of Course Design

Developing an Android App. CSC207 Fall 2014

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 2 Android Platform. Marco Picone

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Android Services. Services

Q1. What method you should override to use Android menu system?

Android Development. 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系

A Case Study of an Android* Client App Using Cloud-Based Alert Service

ELET4133: Embedded Systems. Topic 15 Sensors

Crystal Reports Integration Plugin for JIRA

Android Environment SDK

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

App Development for Smart Devices. Lec #4: Services and Broadcast Receivers Try It Out

Lecture 1 Introduction to Android

Best Practices for Maximizing Revenue with MoPub. Publisher Playbook

Android Java Live and In Action

Now that we have the Android SDK, Eclipse and Phones all ready to go we can jump into actual Android development.

Developing Android Apps for BlackBerry 10. JAM 354 Matthew Whiteman - Product Manager February 6, 2013

Hacking your Droid ADITYA GUPTA

Web Service Caching Using Command Cache

SDK Quick Start Guide

Self Testing with MoPub SDK

Adobe Marketing Cloud Android SDK 4.x for Marketing Cloud Solutions

Android Environment SDK

the intro for RPG programmers Making mobile app development easier... of KrengelTech by Aaron Bartell

Creating a 2D Game Engine for Android OS. Introduction

Android Application Development: Hands- On. Dr. Jogesh K. Muppala

Android App Development. Rameel Sethi

HTTPS hg clone plugin library SSH hg clone plugin library

How To Write A File Station In Android.Com (For Free) On A Microsoft Macbook Or Ipad (For A Limited Time) On An Ubuntu 8.1 (For Ubuntu) On Your Computer Or Ipa (For

Android 多 核 心 嵌 入 式 多 媒 體 系 統 設 計 與 實 作

HERE SDK for Android. Developer's Guide. Hybrid Plus Version 2.1

App Development for Smart Devices. Lec #4: Files, Saving State, and Preferences

Introduction to Android SDK Jordi Linares

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

ONLINE PREVIEWER MANUAL

Iotivity Programmer s Guide Soft Sensor Manager for Android

@ME (About) Marcelo Cyreno. Skype: marcelocyreno Linkedin: marcelocyreno Mail:

Android Persistency: Files

Appspace 5.X Reference Guide (Digital Signage) Updated on February 9, 2015

Tutorial #1. Android Application Development Advanced Hello World App

APPFORUM2014. Helping the developer community build next-generation, multi-platform apps. SCHAUMBURG, ILLINOIS SEPTEMBER 8-10

Spring Design ScreenShare Service SDK Instructions

Getting Started: Creating a Simple App

Mobile Application Development Google Maps Android API v2

Saindo da zona de conforto resolvi aprender Android! by Daniel Baccin

Developing NFC Applications on the Android Platform. The Definitive Resource

Transcription:

AdFalcon Android SDK 214 Developer's Guide AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Table of Contents 1 Introduction 3 Supported Android version 3 2 Project Configurations 4 Step 1: Add JARs 4 Step2: Configure manifest 4 1 Configure Application Permissions 4 2 Add the SDK s Activities 4 3 Configure Orientation Changes Handling 5 4 Hardware Acceleration 5 5 Adding Google Play Service 5 3 Banner Ads 6 Adding Banner Ads 6 A Without XML layout 6 B With XML layout 7 Advanced Banner Ads Options 8 Tracking Ad Lifecycle Events ADFlistener 8 ADFAdSize 8 Refresh Ad 9 Disable Hardware Acceleration 9 4 Interstitial Ad 10 5 Appendix 12 ADFAdSize enum 12 ADFErrorCode enum 12 ADFListener interface 12 ADFTargetingParams class 13 ADFView class 14 ADFInterstitial class 15 6 More Information: 16 Copyright Noqoush Mobile Media Group All rights reserved 2

1 Introduction AdFalcon Android SDK developer s guide contains all the information needed by Android developers to integrate with the AdFlacon Network The guide will also show examples and code snippets on how to perform the integration Supported Android version This SDK is designed to work on all Android platforms starting from Android version 23 to the last version; currently version 443 Copyright Noqoush Mobile Media Group All rights reserved 3

2 Project Configurations This section illustrates how to integrate the AdFalcon Android SDK within your application Step 1: Add JARs Add AdFalconAndroidSDK214jar and gson-171jar to your application s Libs folder Step2: Configure manifest 1 Configure Application Permissions Add the below permissions to your application manifestxml Required permissions The below permissions are required to use the SDK In case you do not enable them, the SDK will throw an exception to inform you that INTERNET/ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifestxml <uses-permission android:name="androidpermissioninternet"/> <uses-permission android:name="androidpermissionaccess_network_state"/> Recommended Permissions The below permissions are highly recommended as they allow highly interactive rich media ads If you decide not to add any of the permissions below the AdFalcon SDK will continue to work yet some of the rich media ads functions will be disabled <uses-permission android:name="androidpermissionaccess_fine_location"/> <uses-permission android:name="androidpermissionwrite_calendar"/> <uses-permission android:name="androidpermissionread_calendar"/> <uses-permission android:name="androidpermissionwrite_external_storage"/> 2 Add the SDK s Activities Add the below activities to your AndroidManifest <activity android:name="comnoqoushadfalconandroidsdkadfbrowser" android:configchanges="keyboard keyboardhidden orientation uimode screenlayout screensize sm allestscreensize" android:hardwareaccelerated="true"> </activity> <activity android:name="comnoqoushadfalconandroidsdkadfactivity" android:configchanges= "keyboard keyboardhidden orientation uimode screenlayout screensize smallestscreensize" android:theme="@android:style/themetranslucentnotitlebarfullscreen" Copyright Noqoush Mobile Media Group All rights reserved 4

android:hardwareaccelerated="true"> </activity> <activity android:name="comnoqoushadfalconandroidsdkadfcanvas" android:configchanges= "keyboard keyboardhidden orientation uimode screenlayout screensize smallestscreensize" android:theme="@android:style/themetranslucentnotitlebar" android:hardwareaccelerated="true"> </activity> 3 Configure Orientation Changes Handling It is highly recommended to prevent the system from restarting your activity when the screen orientation changes Add the below attribute to your activity tag: android:configchanges= "keyboard keyboardhidden orientation uimode screenlayout screensize smallestscreensize" For more information please refer to http://developerandroidcom/guide/topics/resources/runtime-changeshtml 4 Hardware Acceleration AdFalcon network supports HTML 5 video ads which requires enabling hardware acceleration We recommended that the developer enables hardware acceleration in his application by adding the below property to application tag or to each activity that contains AdFalcon banner android:hardwareaccelerated="true" 5 Adding Google Play Services The terms and conditions of Google Play requires using the Advertising ID to identify and track a user The Advertising Id is included in Google Play services library, so you must add Google Play services library to your application to integrate with AdFalcon Android SDK Visit the below link for instruction on how to add Google play services library: http://developerandroidcom/google/play-services/setuphtml Copyright Noqoush Mobile Media Group All rights reserved 5

3 Banner Ads Adding Banner Ads The section below illustrates the simplest way to add Banner Ads to your application A Without XML layout Add the following snippet of code to your activity to add, initialize and load ad view import javatextsimpledateformat; import javautildate; import javautilvector; import androidwidgetlinearlayout; import comnoqoushadfalconandroidsdkadflistener; import comnoqoushadfalconandroidsdkadftargetingparams; import comnoqoushadfalconandroidsdkadfview; import comnoqoushadfalconandroidsdkconstantadfadsize; import comnoqoushadfalconandroidsdkconstantadferrorcode; // Add private member variable of type ADFView private ADFView adfalconview; public void oncreate(bundle savedinstancestate) { superoncreate(savedinstancestate); setcontentview(rlayoutmain); try { // create new instance of ADFView adfalconview = new ADFView(this); //Ensure test mode is setting to false when your app is uploaded in the marketing adfalconviewsettestmode(false); // initialize the view by pass site id, ad unit size and enable auto refresh // then load first ad adfalconviewinitialize("your site ID", ADFAdSizeAD_UNIT_320x50, null, null, true); // Add ADFView to this activity // we consider there is a layout naming linearlayout and // you want to add ADFView in this layout ((LinearLayout) findviewbyid(ridlinearlayout))addview(adfalconview); catch (Exception ex) { @Override protected void ondestroy() { adfalconviewdestroy(); superondestroy(); Note: Refer to the appendix ADFAdSize for the available Ad Unit sizes Note: Ensure test mode is set to true only during development Before shipping to production set it to false Copyright Noqoush Mobile Media Group All rights reserved 6

B With XML layout Follow the steps below to add AdFalcon Banner Ad view: 1 Add ADFView to your activity XML layout <comnoqoushadfalconandroidsdkadfview android:id="@+id/adfalconview" android:layout_width="wrap_content" android:layout_height="wrap_content"/> 2 Add the following snippet of code to your activity class to initilize, load and render the ad view import javatextsimpledateformat; import javautildate; import javautilvector; import androidwidgetlinearlayout; import comnoqoushadfalconandroidsdkadflistener; import comnoqoushadfalconandroidsdkadftargetingparams; import comnoqoushadfalconandroidsdkadfview; import comnoqoushadfalconandroidsdkconstantadfadsize; import comnoqoushadfalconandroidsdkconstantadferrorcode; // Add private member variable of type ADFView private ADFView adfalconview; public void oncreate(bundle savedinstancestate) { superoncreate(savedinstancestate); setcontentview(rlayoutmain); try { // create new instance of ADFView adfalconview = ((ADFView)findViewById(RidadFalconView)); //Ensure test mode is setting to false when your app is uploaded in the marketing adfalconviewsettestmode(true); // initialize the view by pass publisher id, ad unit size, params, // listener and enable auto refresh // then load first ad adfalconviewinitialize("your site ID", ADFAdSizeAD_UNIT_320x50, null, null, true); catch (Exception ex) { @Override protected void ondestroy() { adfalconviewdestroy(); superondestroy(); Note: Refer to the appendix ADFAdSize for the available Ad Unit sizes Note: Ensure test mode is set to true only during development Before shipping to production set it to false Copyright Noqoush Mobile Media Group All rights reserved 7

Advanced Banner Ads Options Tracking Ad Lifecycle Events ADFlistener ADFListener provides ability to track Ad lifecycle events Implement the following abstract methods public class MainActivity extends Activity implements ADFListener{ public void oncreate(bundle savedinstancestate) { superoncreate(savedinstancestate); setcontentview(rlayoutmain); try { // create new instance of ADFView adfalconview = ((ADFView)findViewById(RidadFalconView)); //Ensure test mode is setting to false when your app is uploaded in the marketing adfalconviewsettestmode(true); // initialize the view by pass publisher id, ad unit size, params, // listener and enable auto refresh // then load first ad adfalconviewinitialize("your site ID", ADFAdSizeAD_UNIT_320x50, null, this, true); // set the listener to ADFView adfalconviewsetlistener(this); catch (Exception ex) { public void onloadad(adfad ad) { public void onerror(adfad ad, ADFErrorCode code, String message) { public void onpresentadscreen(adfad ad) { public void ondismissadscreen(adfad ad) { public void onleaveapplication() { ADFAdSize ADFAdSize Enum defines the ad units supported by the AdFalcon Enum Name Size Devices AD_UNIT_AUTO_BAN NER Auto Banner The server will detect the best ad unit size based on the screen size and orientation AD_UNIT_320x40 Standard 320 x 45 All AD_UNIT_300x250 Medium Rectangle 300 x 250 All AD_UNIT_468x60 Full Banner 468 x 60 Tablet All Copyright Noqoush Mobile Media Group All rights reserved 8

AD_UNIT_728x90 Leaderboard 728 x 90 Tablet AD_UNIT_120x600 Skyscraper 120 x 600 Tablet Refresh Ad Use the below methods to configure ad refreshment Method public void refreshad() public void setrefreshduration( int duration) Description Used to get a new ad programmatically Determine the refresh duration in seconds among the receivedads Note: The duration range starts from 30 to 120 seconds public void setenableautorefresh( boolean enable) Used to enable/disable the auto refresh for the received ads Disable Hardware Acceleration If you noticed flickering in the ad view or any other user interface element in your activity, you can disable hardware acceleration by implementing the below snippet of code However, this is not recommended because HTML 5 video ads will not be played correctly ADFViewsetLayerType(ViewLAYER_TYPE_SOFTWARE, null); Copyright Noqoush Mobile Media Group All rights reserved 9

4 Interstitial Ad Interstitial is a full screen ad that appears between levels, before or after viewing content To add interstitial ad you have to perform the steps below: 1 Implement ADFListener public class MainActivity extends Activity implements ADFListener{ public void onloadad(adfad ad) { public void onerror(adfad ad, ADFErrorCode code, String message) { public void onpresentadscreen(adfad ad) { public void ondismissadscreen(adfad ad) { public void onleaveapplication() { 2 Create instance of ADFInterstitial and load new interstitial ad protected void oncreate(bundle savedinstancestate) { ADFInterstitial adfinterstitial = new ADFInterstitial(this, "your site ID", adfinterstitialloadinterstitialad(); this); 3 When the interstitial is loaded successfully and becomes ready to display the Ad, the SDK will fire onloadad method Therefore you will need to implement onloadad interface s method as below: public void onloadad(adfad ad) { if(ad instanceof ADFInterstitial){ ((ADFInterstitial)ad)showInterstitialAd(); 4 To know if any error has occurred during the loading including no available ad You will need to implement onerror interface s method as the below public void onerror(adfad ad, ADFErrorCode code, String message) { if(ad instanceof ADFInterstitial){ if(code == ADFErrorCodeNO_AD_AVAILABLE){ //Do anything here else if(code == ADFErrorCodeCOMMUNICATION_ERROR){ Copyright Noqoush Mobile Media Group All rights reserved 10

//Do anything here else if(code == ADFErrorCodeMISSING_PARAM){ //Do anything here else{ //Do anything here To know more about Errors codes go to: ADFErrorCode Copyright Noqoush Mobile Media Group All rights reserved 11

5 Appendix ADFAdSize enum ADFAdSize Enum defines the ad units supported by the AdFalcon Enum Name Size Devices AD_UNIT_AUTO_BAN NER Auto Banner The server will detect the best ad unit size based on the screen size and orientation AD_UNIT_320x40 Standard 320 x 45 All AD_UNIT_300x250 Medium Rectangle 300 x 250 All AD_UNIT_468x60 Full Banner 468 x 60 Tablet AD_UNIT_728x90 Leaderboard 728 x 90 Tablet AD_UNIT_120x600 Skyscraper 120 x 600 Tablet All ADFErrorCode enum ADFErrorCode Enum defines AdFalcon SDK and Ad Server error codes Enum GENERIC_SDK_ERROR INTERNAL_SERVER_ERROR COMMUNICATION_ERROR NO_AD_AVAILABLE INVALID_PARAM MISSING_PARAM Description Error occurred in the SDK Error occurred in AdFalcon server SDK can not reach the AdFalcon server; mostly for issues related to the phone internet connection No ad is available in the AdFalcon store that meets the ad request parameters An invalid ad request parameter has been set A required ad request parameter has not been set ADFListener interface ADSListener is an interface that is used to get feedback from the AdFalcon SDK Method public void onloadad( ADFAd ad) public void onerror( ADFAd ad, ADFErrorCode error, String message) Description SDK has loaded an ad SDK has encountered an error during the loading of an ad Params view: AdFalcon view error: type of error message: description for error Copyright Noqoush Mobile Media Group All rights reserved 12

public void onpresentadscreen( ADFAd ad) public void ondismissadscreen( ADFAd ad) public void onleaveapplication() Ad screen is displayed Ad screen has closed The SDK will open the ad in another application ADFTargetingParams class The ADFTargetingParams Class contains all the needed parameters about any given user and application in order to help AdFalcon network to send the most relevant and targeted ad to the user All parameters are optional Variable Required Description Values Language No A two-characters string parameter indicating Ad language Postal code No A string parameter containing the user's postal/zip code ar, en 11121 Area code No A string parameter containing the user's area code Age No An integer parameter containing the user's age Keywords No List of keywords in comma separated format AdFalcon s ads selector engine will search for ads containing these keywords Gender No A parameter containing the user's gender Country code No County code of the end user in ISO 3166-1 alpha-2 format code (two-letter code) 06 27 ex sport, news, lifestyle, etc NONE GENDER_MALE GENDER_FEMALE JO, SA etc Birthdate No Birthdate of application user in format ddmmyyyy Additional Info No A Map of keys and values to add additional parameters Location: Latitude, Longitude No The geolocation information of the device The location information is divided into two double values; latitude and longitude 35654, 346598 Copyright Noqoush Mobile Media Group All rights reserved 13

ADFView class ADFView is the main SDK class and it is responsible for initializing, loading and rendering an ad Method public void initialize( String siteid, ADFAdSize adsize, ADFTargetingParams params, ADFListener listener, boolean autorefresh ) public void refreshad() public void settestmode( boolean test) public void setrefreshduration( int duration) public void setenableautorefresh( boolean enable) public boolean isenableautorefresh() public void setenableanimation( boolean enable) public boolean isenableanimation() public void setlistener( ADFListener listener) public ADFListener getlistener() public void destroy() Description This is the main method in ADFView class and is used to initialize the SDK, load the first Ad and start the auto refresh timer Parameters site ID: You can get this ID from AdFalcon website and it is unique for each application adsize: The size of the needed ad params: contains all the needed params to help AdFalcon network to detect and better target an Ad listener: SDK feedback autorefresh: used to enable auto refresh for ads Used to get a new ad Used to inform AdFalcon network if your application is working in test or production mode Determine the refresh duration in seconds among the receivedads Used to enable/disable the auto refresh for the received ads Used to know if auto refresh timer is running or paused Used to Enable/Disable animation Returns true if the animation is enabled otherwise disabled Set ADFListener Get ADFListener This method must be called either in ondestroy() method to finalize the ADFView or when you do not need to use the ADFView again After calling this method the SDK will kill any timer, thread or running process Copyright Noqoush Mobile Media Group All rights reserved 14

ADFInterstitial class This class is responsible for creating, loading and rendering interstitial ads Method public ADFInterstitial( Context context, String siteid, ADFListener listener, ) public ADFInterstitial( Context context, String siteid, ADFListener listener, boolean testmode ) public ADFInterstitial( Context context, String siteid, ADFListener listener, ADFTargetingParams targetingparams ) public ADFInterstitial( Context context, String siteid, ADFListener listener, ADFTargetingParams targetingparams, boolean testmode ) public void loadinterstitialad() public void showinterstitialad() public boolean isready() public void settestmode( boolean testmode ) Description The interstitial class constructor and is responsible for initializing the interstitial ad with: context your site ID listener Class constructor overload which initializes the interstitial ad with: context your site ID listener Test Mode Flag (Pass true during development only, and false for production release) The interstitial class constructor and is responsible for initializing the interstitial ad with: context your site ID listener targeting parameters Class constructor overload which initializes the interstitial ad with: context your site ID listener targeting parameters Test Mode Flag (Pass true during development only, and false for production release) This method is used to load new interstitial ad You can track if the ad has been loaded successfully by implementing ADSListeneronLoadAd method This method is used to display the interstitial in full screen mode But you cannot call this method if the ad is not loaded successfully We recommended You to check isready() method before calling it This method is used to check if the interstitial ad is ready to display This method is used to set test mode flag Copyright Noqoush Mobile Media Group All rights reserved 15

6 More Information: You can find more information in the sample project within the downloaded zip file For any SDK integration queries, please send us an email to support@adfalconcom along with your login id Copyright Noqoush Mobile Media Group All rights reserved 16