/[projects]/android/admob/javadoc/com/admob/android/ads/package-summary.html
ViewVC logotype

Contents of /android/admob/javadoc/com/admob/android/ads/package-summary.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (show annotations) (download) (as text)
Wed Sep 23 12:54:05 2009 UTC (14 years, 8 months ago) by torben
File MIME type: text/html
File size: 15979 byte(s)
import admob library
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.6.0_13) on Tue Jul 28 18:25:38 PDT 2009 -->
6 <TITLE>
7 com.admob.android.ads
8 </TITLE>
9
10 <META NAME="date" CONTENT="2009-07-28">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17 if (location.href.indexOf('is-external=true') == -1) {
18 parent.document.title="com.admob.android.ads";
19 }
20 }
21 </SCRIPT>
22 <NOSCRIPT>
23 </NOSCRIPT>
24
25 </HEAD>
26
27 <BODY BGCOLOR="white" onload="windowTitle();">
28 <HR>
29
30
31 <!-- ========= START OF TOP NAVBAR ======= -->
32 <A NAME="navbar_top"><!-- --></A>
33 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35 <TR>
36 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37 <A NAME="navbar_top_firstrow"><!-- --></A>
38 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39 <TR ALIGN="center" VALIGN="top">
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../com/admob/android/ads/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
47 </TR>
48 </TABLE>
49 </TD>
50 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
51 </EM>
52 </TD>
53 </TR>
54
55 <TR>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57 &nbsp;PREV PACKAGE&nbsp;
58 &nbsp;NEXT PACKAGE</FONT></TD>
59 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
60 <A HREF="../../../../index.html?com/admob/android/ads/package-summary.html" target="_top"><B>FRAMES</B></A> &nbsp;
61 &nbsp;<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
62 &nbsp;<SCRIPT type="text/javascript">
63 <!--
64 if(window==top) {
65 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
66 }
67 //-->
68 </SCRIPT>
69 <NOSCRIPT>
70 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
71 </NOSCRIPT>
72
73
74 </FONT></TD>
75 </TR>
76 </TABLE>
77 <A NAME="skip-navbar_top"></A>
78 <!-- ========= END OF TOP NAVBAR ========= -->
79
80 <HR>
81 <H2>
82 Package com.admob.android.ads
83 </H2>
84 The <b>AdMob SDK for Android</b> provides the tools you need to embed ads within your Android application.
85 <P>
86 <B>See:</B>
87 <BR>
88 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="#package_description"><B>Description</B></A>
89 <P>
90
91 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
92 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
93 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
94 <B>Interface Summary</B></FONT></TH>
95 </TR>
96 <TR BGCOLOR="white" CLASS="TableRowColor">
97 <TD WIDTH="15%"><B><A HREF="../../../../com/admob/android/ads/AdView.AdListener.html" title="interface in com.admob.android.ads">AdView.AdListener</A></B></TD>
98 <TD>Implement this interface to receive notifications of ad activity.</TD>
99 </TR>
100 </TABLE>
101 &nbsp;
102
103 <P>
104
105 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
106 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
107 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
108 <B>Class Summary</B></FONT></TH>
109 </TR>
110 <TR BGCOLOR="white" CLASS="TableRowColor">
111 <TD WIDTH="15%"><B><A HREF="../../../../com/admob/android/ads/AdManager.html" title="class in com.admob.android.ads">AdManager</A></B></TD>
112 <TD>Provides data required to deliver ads.</TD>
113 </TR>
114 <TR BGCOLOR="white" CLASS="TableRowColor">
115 <TD WIDTH="15%"><B><A HREF="../../../../com/admob/android/ads/AdView.html" title="class in com.admob.android.ads">AdView</A></B></TD>
116 <TD>A view containing an advertisement.</TD>
117 </TR>
118 </TABLE>
119 &nbsp;
120
121 <P>
122
123 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
124 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
125 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
126 <B>Enum Summary</B></FONT></TH>
127 </TR>
128 <TR BGCOLOR="white" CLASS="TableRowColor">
129 <TD WIDTH="15%"><B><A HREF="../../../../com/admob/android/ads/AdManager.Gender.html" title="enum in com.admob.android.ads">AdManager.Gender</A></B></TD>
130 <TD>Male and Female genders.</TD>
131 </TR>
132 </TABLE>
133 &nbsp;
134
135 <P>
136 <A NAME="package_description"><!-- --></A><H2>
137 Package com.admob.android.ads Description
138 </H2>
139
140 <P>
141 <p>The <b>AdMob SDK for Android</b> provides the tools you need to embed ads within your Android application.</p>
142
143 <p>The class you will most frequently use is <code>AdView</code>. It defines an ad widget that you can
144 place into your layout, will fetch an ad from AdMob's servers, and then render it. Typically an
145 <code>AdView</code> should be as wide as the screen. It will always be 48 pixels tall.</p>
146
147 <p>The setup section below describes how to integrate an <code>AdView</code> into your application.
148 However, that is only the first step. There are methods to improve the ad's relevance and appearance.
149 Doing both makes for a better user experience (and will make you more money). Application-level settings,
150 such as specifying the user's gender, are done with methods in the <code>AdManager</code> class.
151 Settings specific to a particular ad, such as its color scheme and keywords that describe its surroundings,
152 are done with methods in <code>AdView</code>.</p>
153
154 <h2>Setup</h2>
155
156 <h4>Including the Jar</h4>
157
158 Add the Jar file included with the SDK to your Android project as an external library. In your project's
159 root directory create a subdirectory <code>libs</code> (this will already be done for you if you used
160 Android's <code>activitycreator</code>). Copy the AdMob Jar file into that directory.
161
162 <p>For Eclipse projects:
163 <ul>
164 <li>Go to the Properties of your project (right-click on your project from the Package Explorer tab and select Properties)</li>
165 <li>Select "Java Build Path" from left panel</li>
166 <li>Select "Libraries" tab from the main window</li>
167 <li>Click on "Add JARs..."</li>
168 <li>Select the JAR copied to the <code>libs</code> directory</li>
169 <li>Click "OK" to add the SDK to your android project</li>
170 </ul>
171
172 <h4>AndroidManifest.xml</h4>
173
174 <p>Your AdMob publisher ID was given to you when creating your publisher account on
175 <a href="http://www.admob.com/">www.admob.com</a> before downloading this code. It is a 15-character
176 code like <i>a1496ced2842262</i>. Just before the closing <code>&lt/application&gt</code> tag
177 add a line to set your publisher ID:
178 <pre><code>
179 &lt;!-- The application's publisher ID assigned by AdMob --&gt;
180 &lt;meta-data android:value="YOUR_ID_HERE" android:name="ADMOB_PUBLISHER_ID" /&gt;
181 &lt/application&gt
182 </code></pre>
183
184 <p>Set any permissions not already included just before the closing <code>&lt/manifest&gt</code> tag:
185 <pre><code>
186 &lt;!-- AdMob SDK permissions --&gt;
187 &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
188 &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
189 &lt/manifest&gt
190 </code></pre>
191
192 Only the <code>INTERNET</code> permission is required. Setting <code>ACCESS_COARSE_LOCATION</code>
193 (and/or <code>ACCESS_FINE_LOCATION</code>) allows narrowly geo-targeted ads be shown.
194
195 <h4>attrs.xml</h4>
196
197 The <code>attrs.xml</code> file specifies custom <code>AdView</code> attributes in XML
198 layout files. If your application does not already have an <code>/res/values/attrs.xml</code> file
199 then create one and copy-and-paste the following into it. If you do have that file then just add
200 the <code>declare-styleable</code> element:
201 <pre><code>
202 &lt;?xml version="1.0" encoding="utf-8"?&gt;
203 &lt;resources&gt;
204 &lt;declare-styleable name="com.admob.android.ads.AdView"&gt;
205 &lt;attr name="testing" format="boolean" /&gt;
206 &lt;attr name="backgroundColor" format="color" /&gt;
207 &lt;attr name="textColor" format="color" /&gt;
208 &lt;attr name="keywords" format="string" /&gt;
209 &lt;attr name="refreshInterval" format="integer" /&gt;
210 &lt;attr name="isGoneWithoutAd" format="boolean" /&gt;
211 &lt;/declare-styleable&gt;
212 &lt;/resources&gt;
213 </code></pre>
214
215 <h4>Placing an <code>AdView</code> in a Layout</h4>
216
217 <code>AdView</code> widgets can be put into any XML layout now. The first step is to reference
218 <code>attrs.xml</code> in your layout element by adding an <code>xmlns</code> line that includes
219 your package name specified in <code>AndroidManifest.xml</code>:
220 <pre><code>
221 xmlns:yourapp="http://schemas.android.com/apk/res/yourpackage"
222 </code></pre>
223
224 <p>For example a simple screen with only an ad on it would look like:
225 <pre><code>
226 &lt;?xml version="1.0" encoding="utf-8"?&gt;
227 &lt;LinearLayout
228 xmlns:android="http://schemas.android.com/apk/res/android"
229 xmlns:admobsdk="http://schemas.android.com/apk/res/com.admob.android.example"
230 android:orientation="vertical"
231 android:layout_width="fill_parent"
232 android:layout_height="fill_parent"&gt;
233
234 &lt;com.admob.android.ads.AdView
235 android:id="@+id/ad"
236 android:layout_width="fill_parent"
237 android:layout_height="wrap_content"
238 admobsdk:backgroundColor="#000000"
239 admobsdk:textColor="#FFFFFF"
240 admobsdk:keywords="Android application"
241 /&gt;
242
243 &lt;/LinearLayout&gt;
244 </code></pre>
245
246 <h4>Test Mode</h4>
247
248 When you start integrating AdMob ads into your application it is recommended to use test mode.
249 This always returns the same ad. Normal ad requests are not deterministic making it harder to
250 be sure the ad view looks like you want (e.g. ad requests can timeout or may not fill).
251
252 <p>Once the ad shows up as you expect be sure to turn test mode off to get real ads. <b>Never
253 put your application into the Android Market with test mode enabled.</b>
254
255 <p>Test mode can be enabled either by calling <code>AdManager.setInTestMode(true)</code> or
256 by adding a "<code>admobsdk:testing="true"</code>" property to the ad in your XML layout
257 (where "<code>admobsdk</code>" is the XML namespace for your application).
258
259 <h2>Example</h2>
260
261 Included with this SDK is a Lunar Lander example. This is the same example found in the
262 Android SDK except it shows an AdMob ad when the game is paused or over.
263
264 <p>The example's build script demonstrates how to obfuscate the source using
265 <a href="http://proguard.sourceforge.net/">ProGuard</a>. To get obfuscation working make sure
266 the <code>proguard.jar</code> property at the top of <code>build.xml</code> points to your local
267 copy.
268
269 <h2>Tips for Ad Placement</h2>
270
271 Effective ads are prominently displayed at natural break points in your application. Correctly
272 answering "when" and "where" ads are placed within your application can increase revenue ten fold.
273
274 <p>People are most likely to click on advertisements at the end of some activity. For example ads
275 in games perform best on game over screens, perform acceptably between levels, and are ineffective
276 when the game is underway. Decide at what point in your application a user can fluidly change
277 what they are doing.
278
279 <p>Advertisements usually perform best near navigation components, at the very top of the screen,
280 or the very bottom. There is a severe drop in performance anywhere else. A good rule of thumb is
281 to place ads at the top of screens that scroll and the bottom of ones that do not. For example
282 we have seen large improvements by placing an ad above a tab bar (at the top of the screen) rather
283 than below it in the tab host container.
284
285 <h2>Help</h2>
286
287 If something is going wrong the first step is to look in Android's LogCat window. Make sure
288 the Android Eclipse plug-in is installed. Then go to the menu <code>Window -> Show View -> LogCat</code>
289 to open it. All AdMob logging is done using the tag "AdMob SDK". The logging shows what is and
290 is not working.
291
292 All of the source code is packaged in the Jar file. When things really go wrong you can step through
293 the AdMob code to see what is going on.
294
295 <a href="mailto:support@admob.com?subject=Android SDK Support Question">AdMob Support</a> is also
296 available to help work through any problems.
297
298 <h2>Related Documentation</h2>
299 <ul>
300 <li><a href="http://www.admob.com/">AdMob Home</a></li>
301 <li><a href="http://developer.admob.com/wiki/Main_Page">AdMob Developer Wiki</a></li>
302 <li><a href="http://code.google.com/android/reference/packages.html">Google's Android JavaDoc</a></li>
303 <li>Contact <a href="mailto:support@admob.com?subject=Android SDK Support Question">support@admob.com</a> with bugs, questions, or feedback!</li>
304 </ul>
305 <P>
306
307 <P>
308 <DL>
309 </DL>
310 <HR>
311
312
313 <!-- ======= START OF BOTTOM NAVBAR ====== -->
314 <A NAME="navbar_bottom"><!-- --></A>
315 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
316 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
317 <TR>
318 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
319 <A NAME="navbar_bottom_firstrow"><!-- --></A>
320 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
321 <TR ALIGN="center" VALIGN="top">
322 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../com/admob/android/ads/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
323 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
324 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
325 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
326 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
327 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
328 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
329 </TR>
330 </TABLE>
331 </TD>
332 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
333 </EM>
334 </TD>
335 </TR>
336
337 <TR>
338 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
339 &nbsp;PREV PACKAGE&nbsp;
340 &nbsp;NEXT PACKAGE</FONT></TD>
341 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
342 <A HREF="../../../../index.html?com/admob/android/ads/package-summary.html" target="_top"><B>FRAMES</B></A> &nbsp;
343 &nbsp;<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
344 &nbsp;<SCRIPT type="text/javascript">
345 <!--
346 if(window==top) {
347 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
348 }
349 //-->
350 </SCRIPT>
351 <NOSCRIPT>
352 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
353 </NOSCRIPT>
354
355
356 </FONT></TD>
357 </TR>
358 </TABLE>
359 <A NAME="skip-navbar_bottom"></A>
360 <!-- ======== END OF BOTTOM NAVBAR ======= -->
361
362 <HR>
363
364 </BODY>
365 </HTML>

  ViewVC Help
Powered by ViewVC 1.1.20