How to add Google Adsense Ads to your Android App
[출처] http://flyloopproject.blogspot.com/2010/06/how-to-add-google-adsense-ads-to-your_27.html

After I got a taste of how is to build apps for Android on mobile, I wanted to go further and insert ads into my apps. Other apps that I previously downloaded had that and it wasn't that annoying seeing ads at the bottom of my screen and I felt good that free apps can get people's support through Adsense mechanism.


I read a little bit on the Google's Adsense Setup page that you can "Unlock the revenue potential of your mobile site with targeted Google ads." This sounded so good that I wanted to try.
But wait, Google is talking about my mobile sites where I can put Google ads, while I'm trying to add these ads to my android apps. How can I do that ? You'll see that is not that complicated and in fact is very simple .


And here is how I succeeded adding Google Adsense Ads to my android apps: "World Cup Goal Scream" and "World Cup Red Vuvuzela". You can download these apps from android market to get a feeling of what I'm talking about.


The following is a step by step guide for you and for me. Yes for me too, because we always forget stuff and thank God to the internet that we have a place to come back and save the day.


Ok, let's go


Step 1:
Create a Google account, if you don't have one, and log in to the Google Adsense site (https://www.google.com/adsense)


Step 2:
Select "Adsense Setup" from the menu


Step 3:
Select "AdSense for Mobile Content New high-end devices!" and follow the wizard steps to customize you ads.


Step 4:
Get "Your AdSense code" and save it to an empty html page


<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="www.flyloopproject.com">
<title>World Cup Goal Scream Ads</title>
</head>
<body marginwidth="0" marginheight="0 leftmargin="0"
topmargin="0" style="background-color: black">
.....insert your Adsense Code here.........
</body>
</html>


And save the page, for example call it myads.html


Step 5:
Upload this page to your website, oh you need a place on the internet where you can upload stuff

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com


Step 6:
Test the page on your mobile phone by opening the page that you just upload.
Note!: it won't display any content if you open the page from your computer's web browser. You have to test it on your mobile web browser. Check out my ads page: http://flyloopproject.com/myads.html

Step 7:
Now that you have this page, you probably ask yourself "How the hack do I add it to my app ?"
Well don't worry you are on track to do this.
Take a deep breath of fresh air and proceed with the next step.


Step 8:
Open your Android project and edit the View where you want to add your ads.
For example you can add ads to your main.xml where you'll place a WebView component.


 <LinearLayout android:id="@+id/adsHolder"
  android:layout_width="fill_parent" android:layout_height="wrap_content"
  android:orientation="vertical" android:layout_alignParentBottom="true"
  android:layout_centerInParent="true" android:paddingTop="5px">
        <WebView android:id="@+id/adsDisplay" android:layout_width="fill_parent"
           android:layout_height="fill_parent" />
 </LinearLayout>


Step 9:
All you have to do now is to wire up the WebView component that you just add to your web page created in Step 4


public class MainActivity extends Activity {
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
...............
     
WebView adsDisplay = (WebView) findViewById(R.id.adsDisplay);
      adsDisplay.getSettings().setJavaScriptEnabled(true);
      adsDisplay.loadUrl("http://flyloopproject.com/myads.html");
...............
}
}


Step 10:
Add user INTERNET permission to your app by editing the AndroidManifest.xml file


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


Step 11:
You're done, test it by building your app and run it with your emulator or on your mobile phone and you should see your ads at the bottom of your screen.


A quick overview of the steps
Step 1 : Log in to the Google Adsense site https://www.google.com/adsense
Step 2-3 : Get Your Adsense Code
Step 4 : Save it to an empty web page (example: http://flyloopproject.com/myads.html)
Step 5 : Upload the page to your website
Step 6 : Test it on your mobile
Step 7 : Fresh air
Step 8 : Add a WebView component to a view in your android project
Step 9 : Wire up the component to display you web page that you just created in Step 4
Step 10 : Add INTERNET permission to your app
Step 11 : FINISH (check your heart rate :) )


That's pretty much it.


I hope that you find this posting useful and don't stop building free apps and get support for your development using Google Adsense for mobile.


If you find this blog entry useful don't stop sharing with your friends and CLICK MY ADS to support my development and I'll get you more tutorials
Posted by flylup at 8:45 AM

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
138 [신규] 안드로이드 개발자 등록시 판매자 계정 신청 비활성화 되신 분들 file 가을의 곰을... 2012.05.24 7554
137 소프트웨어 특허출원, 소프트웨어 특허 명세서 작성법 안내 가을의 곰을... 2012.05.14 5475
» 안드로이드 앱에 애드센스 추가하기 가을의 곰을... 2012.05.09 8361
135 특허출원방법 특허청 (hwp문서) 가을의 곰 2012.05.09 5234
134 특허 출원 방법특허출원 방법/ 특허 file 가을의 곰을... 2012.05.09 5318
133 부가가치세(부가세) 인터넷 납부, 홈택스를 통한 납부 방법 file 가을의 곰을... 2012.05.08 6129
132 상표 등록(출원) 혼자서 하기 4편. 출원서 제출과 출원비용 납부하기 file 가을의 곰을... 2012.05.08 5383
131 상표 등록(출원) 혼자서 하기 3편. 서식작성기를 통한 출원서 작성하기 file 가을의 곰을... 2012.05.08 5046
130 상표 등록(출원) 혼자서 하기 2편, 특허청의 인증서 발급과 문서작성 프로그램 설치 file 가을의 곰을... 2012.05.08 6009
129 상표 등록(출원) 혼자서 하기 1편, 특허청에서 상표등록을 위한 출원인코드부여 신청 file 가을의 곰을... 2012.05.08 4810
128 xcode3 과 xcode4 동시에 설치하기 file 가을의 곰을... 2012.05.06 6301
127 [Xcode4] 간편하진 인터페이스빌더 - Outlet, Action 추가/연결 방법 file 가을의 곰을... 2012.05.06 5947
126 xcode3 개발환경에서 xcode4 개발환경으로 이주하기 file 가을의 곰을... 2012.05.06 8502
125 폰갭(phonegap) 에서의 음성인식 웹 검색 file 가을의 곰을... 2012.05.06 4710
124 [책] 내 책을 출판하는 방법, 책 쓰는 방법 file 가을의 곰을... 2012.05.05 4835
123 sourceinsight 환경설정 및 단축키 file 가을의 곰을... 2012.05.01 8371
122 고령자 유망직업 20가지 가을의 곰을... 2012.05.01 4795
121 2010년 정보시스템감리사 세부출제분야 가을의 곰을... 2012.04.29 4787
120 2009년도 감리사 필기시험 출제 분야(안) 가을의 곰을... 2012.04.29 4896
119 [소방전기] 승자와 패자 가을의 곰을... 2012.04.29 4751
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED