Download presentation
Presentation is loading. Please wait.
Published byLeslie Thomas Modified over 9 years ago
1
1 Mobile Computing Monetizing An App Copyright 2014 by Janson Industries
2
2 Objectives ▀ Learn about: u The various ad companies u Ad measurements u AdViews u Define an ad using XML and java
3
Copyright 2014 by Janson Industries 3 Ad Companies ▀ AdMob, Inmobi, Mopub, Jumptap, Tapit, Smaato, Mobfox, AdSense ▀ They provide code that you add to your app ▀ Their code figures out size of ad to display based on the device
4
Copyright 2014 by Janson Industries 4 Measurements ▀ CTR – click through rate u % of people who click on an ad ► If the ad is displayed 100 times and is clicked twice, the ctr is 2% or.02 ▀ CPC – cost per click u How much advertiser will pay you for each click ► 47 cents for each click through
5
Copyright 2014 by Janson Industries 5 Measurements ▀ eCPM – effective cost per thousand ad views (impressions) u How much you should make for a thousand ads being displayed u Need to multiply CPC (.47) by 1000 by CTR (.02) ►.47 * 1000 *.02 = $9.40 ▀ Ad companies track all these measurements (and report them to you)
6
Copyright 2014 by Janson Industries 6 Admob provides reports
7
Copyright 2014 by Janson Industries 7 Notice reported stats
8
Copyright 2014 by Janson Industries 8 Detailed stats
9
Copyright 2014 by Janson Industries 9 My sad, unpopular app
10
Copyright 2014 by Janson Industries 10 Measurements ▀ Most of the ad companies won’t let you post these numbers ▀ Also, if they see unusual numbers: u A CTR of 57% u Clicks are done by a small % of users or locations ► They may shut down your app People have their friends, relatives, and neighbors download app and click ads
11
Copyright 2014 by Janson Industries 11 Going to use AdMob (owned by Google) http://www.google.com/ads/admob/
12
Copyright 2014 by Janson Industries 12 Sign up using your google account
13
Copyright 2014 by Janson Industries 13 If you are at the same computer that you created the account on they will know who you are! If so, fill in the password
14
Copyright 2014 by Janson Industries 14
15
Copyright 2014 by Janson Industries 15 Specify info for an Admob account then click Continue
16
Copyright 2014 by Janson Industries 16 Scroll down, accept Terms, click Submit
17
Copyright 2014 by Janson Industries 17 Click Add Your First App
18
Copyright 2014 by Janson Industries 18 Specify tax and payment info, the click Submit
19
Copyright 2014 by Janson Industries 19 Click Sites and Apps then Android App
20
Copyright 2014 by Janson Industries 20 Fill in app info and click Continue
21
Copyright 2014 by Janson Industries 21 Go to https://apps.admob.com/#home click Monetize new app
22
Copyright 2014 by Janson Industries 22 Specify Project name and Android
23
Copyright 2014 by Janson Industries 23 Specify Ad type and give it a name
24
Copyright 2014 by Janson Industries 24 You can change some ad formatting
25
Copyright 2014 by Janson Industries 25 You need the add unit ID and you can have them info email to you
26
Copyright 2014 by Janson Industries 26 Specify email address to send to
27
Copyright 2014 by Janson Industries 27 The Ad unit ID that you will need to get ads
28
Copyright 2014 by Janson Industries 28 Go back to Home, scroll down, and the project(s) should be displayed
29
Copyright 2014 by Janson Industries 29 Creating From Scratch ▀ Must create a new project (AdProj) with a min target of 3.2, package (my.ad.com), activity (AdProjActivity), and layout (main) u Example will be 4.X ▀ Need to: u Add a reference to the Google play services library u Modify the Manifest
30
Copyright 2014 by Janson Industries 30
31
Copyright 2014 by Janson Industries 31 Must import google-play-services_lib into the workspace (Should already be there from MapProj but if not…) File, Import, expand the Android folder and select Existing Android Code Into WorkSpace, then click Next
32
Copyright 2014 by Janson Industries 32 Click the Browse button then navigate to the sdk/extras/google/google_play_services/libproject/google -play-services_lib, click OK then Finish
33
Copyright 2014 by Janson Industries 33 Click Android Right click AdProj and select Properties
34
Copyright 2014 by Janson Industries 34 Scroll down, click Add, then select the library and click OK c
35
Copyright 2014 by Janson Industries 35 Setup ▀ Manifest have: u The following meta tag in the application element u The following activity defined
36
Copyright 2014 by Janson Industries 36
37
Copyright 2014 by Janson Industries 37 Setup u The following permissions outside the application tags
38
Copyright 2014 by Janson Industries 38
39
Copyright 2014 by Janson Industries 39 Defining an Ad ▀ Use an AdView component ▀ Two ways to define an AdView u With xml in the layout u With java in the activity ▀ Will define an AdView component in xml
40
Copyright 2014 by Janson Industries <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" ads:adUnitId="ca-app-pub-6333216089167186/1679833953" ads:adSize="BANNER"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> 40 Don’t forget to substitute your Ad Unit ID in the adUnitId parameter main.xml
41
Copyright 2014 by Janson Industries 41 AdProjActivity.java ▀ Need to import ▀ Need an AdView variable and object in onCreate then u After setContentView, create an AdRequest and add a test device u Load ad into adView import com.google.android.gms.ads.*; // Look up the AdView as a resource and load a request. AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("abc").build(); adView.loadAd(adRequest);
42
Copyright 2014 by Janson Industries 42 AdProjActivity.java ▀ You will get a test ad u Google doesn't want you to download real ads while testing ▀ To get a real add // Look up the AdView as a resource and load a request. AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder() //.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) //.addTestDevice("abc").build(); adView.loadAd(adRequest);
43
Copyright 2014 by Janson Industries 43 AdProjActivity.java ▀ Have to run to get a real TestDevice number ▀ Find in logcat
44
Copyright 2014 by Janson Industries 44 AdProjActivity.java ▀ Substitute for abc // Look up the AdView as a resource and load a request. AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder()..addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("B3EEABB8EE11C2BE770B684D95219ECB").build(); adView.loadAd(adRequest);
45
Copyright 2014 by Janson Industries 45
46
Copyright 2014 by Janson Industries 46 ads:adSize="SMART_BANNER"
47
Copyright 2014 by Janson Industries 47 ads:adSize="MEDIUM_RECTANGLE"
48
Copyright 2014 by Janson Industries 48 Other Types of Ad n Interstitial Ads u Full screen ads with a close button u More expensive, therefore there are often display limits
49
Copyright 2014 by Janson Industries 49 Go back to AdMob and add an Interstatial add to the app
50
Copyright 2014 by Janson Industries 50 Specify timeout and ad name
51
Copyright 2014 by Janson Industries 51
52
Copyright 2014 by Janson Industries 52
53
Copyright 2014 by Janson Industries 53
54
Copyright 2014 by Janson Industries 54 Interstitial n Need class level variables n In onCreate, create an InterstitialAd object, set the Ad Unit ID, create the AdRequest and load the ad private InterstitialAd interstitial; private static final String AD_UNIT_ID = "ca-app-pub- 6333216089167186/1679833953"; interstitial = new InterstitialAd(this); interstitial.setAdUnitId(AD_UNIT_ID); // Create ad request. AdRequest adRequest = new AdRequest.Builder().build(); // Begin loading the interstitial interstitial.loadAd(adRequest);
55
Copyright 2014 by Janson Industries 55 Interstitial Ads n Can take a while to load n If you try to display before loaded will get an error n So we will put a button on the screen and show the ad after the button is touched
56
Copyright 2014 by Janson Industries <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginLeft="100px"> <Button android:id="@+id/Btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="doClick" android:text="Show Ad" /> 56 main.xml
57
Copyright 2014 by Janson Industries 57 doClick in AdProjActivity n Time to test import android.view.View; : : : public void doClick(View arg0) { interstitial.show(); }
58
Copyright 2014 by Janson Industries 58 Check in logcat that ad has loaded
59
Copyright 2014 by Janson Industries 59 Click Show Ad
60
Copyright 2014 by Janson Industries 60 AdListeners n In java, Activity can implement the AdListener interface n Then tie the ad listener to the adView adView.setAdListener(this);
61
Copyright 2014 by Janson Industries 61 AdListeners n Activity can implement onAdxxx methods that are called when ad is: u Successfully and unsuccessfully received F onAdLoaded, onAdFailedToLoad u When ad is overlaid on the screen F onAdOpened u Ad dismissed and returning to app F onAdClosed u When ad clicked F onAdLeftApplication
62
Copyright 2014 by Janson Industries 62 AdListeners n So instead of having a button to display the ad u Create onAdLoaded method and have it display the ad n And if ad doesn't load u Create onFailedToLoad method to retry to load the ad
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.