LifeStreet Media Android Publisher SDK Integration Guide

Similar documents
UNDERSTANDING ACTIVITIES

LECTURE NOTES OF APPLICATION ACTIVITIES

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

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

Android Application Development. By : Shibaji Debnath

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

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

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ]

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.

Activities. Repo:

Vienos veiklos būsena. Theory

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING

Manifest.xml. Activity.java

East West University

Learn about Android Content Providers and SQLite

Created By: Keith Acosta Instructor: Wei Zhong Courses: Senior Seminar Cryptography

Getting Started With Android Feature Flags

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

Tabel mysql. Kode di PHP. Config.php. Service.php

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface?

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Multiple Activities. Many apps have multiple activities

Applications. Marco Ronchetti Università degli Studi di Trento

Update to newest version and translate to English.

Android Tutorial: Part 3

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Solving an Android Threading Problem

Notification mechanism

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application.

Basic UI elements: Android Buttons (Basics) Marco Ronchetti Università degli Studi di Trento

Android Programming วรเศรษฐ ส วรรณ ก.

EMBEDDED SYSTEMS PROGRAMMING Android NDK

<uses-permission android:name="android.permission.internet"/>

Tutorial: Setup for Android Development

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Android Workshop: Model View Controller ( MVC):

Android framework overview Activity lifecycle and states

Introduction to Android

Android Services. Victor Matos Cleveland State University. Services

Computer Science E-76 Building Mobile Applications

PROGRAMMING APPLICATIONS DECLARATIVE GUIS

Graphics with libgdx

Android UI Development

Security model. Marco Ronchetti Università degli Studi di Trento

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

Getting started: Installing IDE and SDK. Marco Ronchetti Università degli Studi di Trento

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

Lab 1: Getting Started With Android Programming

INTRODUCTION TO ANDROID

Android Beginners Workshop

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

Basic GUI elements - exercises

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

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Tutorial: Setup for Android Development

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

Real-Time Embedded Systems

Intents. Your first app assignment

Embedded Systems Programming - PA8001

Android - JSON Parser Tutorial

PHONE ALERT SYSTEM ANISHA RAYAPATI. B. Tech., Jawaharlal Technological University, 2010 A REPORT

HEALTHY HOME SOWMYA MOTHEKANI B.E., OSMANIA UNIVERSITY, INDIA, 2014 A REPORT. submitted in partial fulfillment of the requirements for the degree

Assignment 1. Start: 28 September 2015 End: 9 October Task Points Total 10

Click-Through URL. Click-Through URL. Overview. Mobile SDK Structure. Examples of Use. Android. ios. Android. On This Page

Login with Amazon. Getting Started Guide for Android apps

EMBEDDED SYSTEMS PROGRAMMING Android Services

ELET4133: Embedded Systems. Topic 15 Sensors

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Overview of Activities

Android development. Outline. Android Studio. Setting up Android Studio. 1. Set up Android Studio. Tiberiu Vilcu. 2.

Android permissions Defining and using permissions Component permissions and related APIs

App Development for Android. Prabhaker Matet

EMBEDDED SYSTEMS PROGRAMMING Android NDK

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

MATLAB Production Server Interface for TIBCO Spotfire. Software. Reference Architecture

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

Introduction to Android Development

Database Development In Android Applications

Tutorial: Android Object API Application Development. Sybase Unwired Platform 2.2 SP03

Designing Apps Using The WebView Control

Theme 2 Program Design. MVC and MVP

App Development for Smart Devices. Lec #9: Advanced Topics

Our First Android Application

Fragment Example Create the following files and test the application on emulator or device.

Android Development Tutorial. Yi Huang

Android Activities. Akhilesh Tyagi

Simple Currency Converter

Mobila applikationer och trådlösa nät, HI1033, HT2012

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

Basics of Android Operating System

Cheetah Orion Ad Platform SDK Guide (for Android) V1.0

Android Overview. Most of the material in this section comes from

SAAdobeAIRSDK Documentation

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Transcription:

LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation

Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM SDK to your project... 4 Adding Lifestreet Media Ads to your application... 9 Notifications and Targeting Information... 10 Auto Refresh... 11 Interstitials... 12 Close Button... 12 Custom Events... 12 2

Introduction The purpose of this document is to outline how to integrate the LifeStreet advertising SDK into your application. Use this document if: You want to serve LifeStreet ads in your application You are using the LifeStreet SDK with an SDK mediation service (e.g AdWhirl) You ve talked through integration with your account manager. Downloading the SDK To get the software development kit, please contact your account manager: msupport@lifestreet.com Choose type of SDK We provide two versions of SDK: Binary library Source code These versions share the same functionality both allow you to integrate LifeStreet Media advertisements into your Android applications. We provide a source version for users who want more control or customization of the SDK. For users looking for a turnkey solution, the binary version is available. Both source and binary versions of SDK requires a run-time of Android 2.3 or later (set android:minsdkversion to at least 9 in your AndroidManifest.xml) 3

Adding the LSM SDK to your project 1. Right click on your app project and choose Properties: 4

a). For binary version of the SDK select Java Build Path and Libraries tab, and then click Add External JARs Choose lsmsdk.jar. 5

Then open Order and Export tab and check lsmsdk.jar 6

b). For source version select Java Build Path and Source tab, and then click Add Folder Choose lsmsdk. 2. Modify your AndroidManifest.xml file to include following permissions: <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.read_phone_state"/> <uses-permission android:name="android.permission.write_external_storage"/> Optionally, you can include: <uses-permission android:name="android.permission.access_fine_location"/> Also, declare required LSM activities: <activity android:name="com.lifestreet.android.lsmsdk.ads.interstitialadactivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode scre ensize smallestscreensize"/> <activity android:name="com.lifestreet.android.lsmsdk.mraid.mraidinterstitialactivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode scre ensize smallestscreensize"/> 7

<activity android:name="com.lifestreet.android.lsmsdk.mraid.videoplayeractivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode scre ensize smallestscreensize"/> Here is the example of the configured AndroidManifest.xml file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.lifestreet.android.lsmsdksample" android:versioncode="1" android:versionname="1.0"> <uses-sdk android:minsdkversion="7" android:targetsdkversion="17"/> <!-- Required permissions --> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.read_phone_state"/> <uses-permission android:name="android.permission.write_external_storage"/> <!-- Optional permissions --> <uses-permission android:name="android.permission.access_fine_location"/> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme"> <!-- LSM --> <activity android:name="com.lifestreet.android.lsmsdk.ads.interstitialadactivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode screensize smallestscreensize"/> <activity android:name="com.lifestreet.android.lsmsdk.mraid.mraidinterstitialactivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode screensize smallestscreensize"/> <activity android:name="com.lifestreet.android.lsmsdk.mraid.videoplayeractivity" android:configchanges="keyboard keyboardhidden orientation screenlayout uimode screensize smallestscreensize"/> <!-- Your activities --> <activity android:name="com.lifestreet.android.lsmsdksample.mainactivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity> </application> </manifest> 8

Adding Lifestreet Media Ads to your application To place Lifestreet ad views in your application and make ad requests: 1. Add SlotView to your layout: <com.lifestreet.android.lsmsdk.slotview android:id="@+id/slotview" android:layout_width="fill_parent" android:layout_height="53dp" slot_slottag="my_slot_tag" slot_autorefreshenabled="true"/> Alternatively, you can create SlotView dynamically: SlotView slotview = new SlotView(this); slotview.setslottag("my_slot_tag"); slotview.setautorefreshenabled(true); 2. Replace MY_SLOT_TAG with your LSM Slot Tag. Set appropriate view s width and height. 3. Implement SlotListener interface (Optional). slotview.setlistener(this); 4. Add SlotView to the view hierarchy. 5. Call the loadad method to start loading and showing ads. slotview.loadad(); 6. Call the destroy method when you no longer need the SlotView. 7. It is recommended to call pause/resume methods when something obscuring the SlotView (e.g. when you open an parent activity). package com.lifestreet.android.lsmsdksample; import android.app.activity; import android.os.bundle; 9

import com.lifestreet.android.lsmsdk.slotview; public class MainActivity extends Activity { @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); slotview.setslottag("my_slot_tag"); slotview.loadad(); @Override protected void ondestroy() { super.ondestroy(); if (slotview!= null) { slotview.destroy(); @Override protected void onpause() { super.onpause(); if (slotview!= null) { slotview.pause(); @Override protected void onresume() { super.onresume(); if (slotview!= null) { slotview.resume(); Notifications and Targeting Information There are number of notifications that you can listen for and utilize; these are part of the SlotListener interface. public interface SlotListener { public void onfailedtoloadslotview(slotview slotview); 10

public void onreceivead(banneradapter<?> adapter, View view); public void onfailedtoreceivead(banneradapter<?> adapter, View view); public void onpresentscreen(banneradapter<?> adapter, View view); public void ondismissscreen(banneradapter<?> adapter, View view); public void onleaveapplication(banneradapter<?> adapter, View view); public void onclick(banneradapter<?> adapter, View view); public void onclose(banneradapter<?> adapter, View view); public void ondestroycustomeventbanneradapter( BannerAdapter<?> adapter, String name); public void onreceiveinterstitialad( InterstitialAdapter<?> adapter, Object ad); public void onfailedtoreceiveinterstitialad( InterstitialAdapter<?> adapter, Object ad); public void onpresentinterstitialscreen( InterstitialAdapter<?> adapter, Object ad); public void ondismissinterstitialscreen( InterstitialAdapter<?> adapter, Object ad); public void onleaveapplicationinterstitial( InterstitialAdapter<?> adapter, Object ad); public void onclickinterstitialad( InterstitialAdapter<?> adapter, Object ad); public void ondestroycustomeventinterstitialadapter( InterstitialAdapter<?> adapter, String name); Also, you can improve quality of ads and increase your revenue by including targeting information (All fields are optional). SlotTargeting targeting = new SlotTargeting(); targeting.setareacode("925"); targeting.setcity("walnut Creek"); targeting.setgender(slottargeting.gender.male); targeting.setmetro("807"); targeting.setregion("ca"); targeting.setzip("94598"); targeting.setlatitude("37.9136962890625"); targeting.setlongitude("-122.01170349121094"); slotview.settargeting(targeting); Auto Refresh By default the ad slot will be reloaded after a certain period of time. You can disable this behavior by calling the setautorefreshenabled(false) method or control this behavior by pause() and resume() methods: slotview.setautorefreshenabled(false); //... or... slotview.pause(); slotview.resume(); 11

Interstitials The SDK also includes support for interstitial ads. Use the InterstitialSlot class instead of the SlotView to show any ads in full-screen mode. It has the same interface as SlotView class. InterstitialSlot slot = new InterstitialSlot(this); slot.setslottag("my_slot_tag"); slot.loadad(); Close Button Interstitial ads show a close button on the screen by default (at the top-right corner). It is disabled by default for banner ads. You can enable/disable the button with setshowclosebutton(boolean showclosebutton) method. Also, SlotView s listener has a method onclose(banneradapter<?> adapter, View view), which will be called when a close button is clicked. slot.setshowclosebutton(true); Custom Events A custom event is a method that is executed when slot loads an ad with NetworkType set to CUSTOM. This method must be implemented in the object that supplied to slotview.setlistener(object) method. When NetworkType = CUSTOM, the method name will be set in property Function. When a custom event view is no longer needed (e.g. a new ad was loaded) the SDK calls a special method which will allows you to do any necessary cleanup. In the following example, the event has the name customfunction. public void customfunction(banneradapterlistener listener, String data) { DisplayMetrics dm = getresources().getdisplaymetrics(); int width = (int) Utils.convertDipsToPixels(320, dm); int height = (int) Utils.convertDipsToPixels(50, dm); RelativeLayout.LayoutParams layoutparams = new RelativeLayout.LayoutParams(width, height); layoutparams.addrule(relativelayout.center_in_parent); TextView customadview = new TextView(this); customadview.setlayoutparams(layoutparams); customadview.settext("custom View"); customadview.setgravity(gravity.center); customadview.setbackgroundcolor(color.blue); 12

// Do something useful with the "data"... listener.onreceivead(customadview); @Override public void ondestroycustomeventbanneradapter( BannerAdapter<?> adapter, String name) { In order to track clicks from your custom banner ad you need to call special method from the adapter listener: listener.onclick(customadview); 13