cs286 graduate presentation -...

22
By Kiruthika Sivaraman CS286 GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS APPLICATIONS

Upload: others

Post on 14-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

By Kiruthika Sivaraman

CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS APPLICATIONS

Page 2: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Introduction

• Setting up AdMob account

• Integration of Ad into Android Application

• Integration of Ad into iOS Application

AGENDA

Page 3: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Advertisements are necessary for the apps to be free for users

• There are various providers who provide SDKs for integrating Ads into mobile application.

• Some of them are AdMob, AdSense.

INTRODUCTION

Page 4: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Go to http://www.admob.com/login/

• Login using your Gmail account

• Add your mobile app/site into which you want to integrate Ads

• Enter your payment details before you add a site

• A publisher ID will be provided once the site has been added successfully .

• This ID will be used later while coding.

SETTING UP ADMOB ACCOUNT

Page 5: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

SETTING UP ADMOB ACCOUNT

Page 6: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Setting up the environment

• A demo application

• Sample output

INTEGRATION OF AD INTO ANDROID APPLICATION

Page 7: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Download the AdMob SDK for Android

• Download it from https://developers.google.com/mobile-ads-sdk/download [or]

• In Eclipse IDE go to Window -> Android SDK Manager -> Extras -> AdMob to install the package

• Create a new Android Application

• Add the AdMob SDK to the build path of the project.

SETTING UP THE ENVIRONMENT

Page 8: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Add the following to the AndroidManifest.xml

A DEMO APPLICATION

Page 9: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• There are two ways to integrate an Ad into Android application – programmatically or through XML configuration file.

• First we have to create an AdView object and associate it with the publisher ID received while adding the site in AdMob

• Next create a new AdRequest object

• Load the AdView with the AdRequest object.

A DEMO APPLICATION

Page 10: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

Programmatic way

A DEMO APPLICATION

Page 11: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

XML way

A DEMO APPLICATION

Page 12: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

SAMPLE OUTPUT

Page 13: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Setting up the environment

• A demo application

• Sample output

INTEGRATION OF AD INTO IOS APPLICATION

Page 14: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Step 1 - Download the AdMob SDK for iOS https://developers.google.com/mobile-ads-sdk/download

• Create a new Single View Application

• Add the downloaded files by right clicking on the project -> Add Files to …

SETTING UP THE ENVIRONMENT

Page 15: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Step 2 - SDK needs the following frameworks: • StoreKit

• AudioToolbox

• MessageUI

• SystemConfiguration

• CoreGraphics

• AdSupport

• To add these frameworks, double click on the project -> Build Phases -> Link Binary with Libraries -> “+”

• Then add all the above specified frameworks.

• Make sure the target is clicked before adding.

SETTING UP THE ENVIRONMENT

Page 16: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

Step 2

SETTING UP THE ENVIRONMENT

Page 17: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Step 3 – Need to add “-ObjC” to the project build settings.

• Double click on the project -> Build Settings -> Linking -> Other Linker Flags

• Add “-ObjC” to both debug and release

SETTING UP THE ENVIRONMENT

Page 18: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

Step 3

SETTING UP THE ENVIRONMENT

Page 19: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Add the below code to the .h file of your project.

A DEMO APPLICATION

Page 20: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

• Add the following code to the viewDidLoad in the .m file.

A DEMO APPLICATION

Page 21: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

SAMPLE OUTPUT

Page 22: CS286 GRADUATE PRESENTATION - Horstmannhorstmann.com/sjsu/spring2013/cs185c/presentations/Kiruthika_Siv… · CS286 – GRADUATE PRESENTATION INTEGRATING AD’S INTO ANDROID AND IOS

Thank You!