468,507 Members | 1,577 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,507 developers. It's quick & easy.

How do i add admob ads in my app ?

14
Steps that I have taken are listed below...

1) I have downloaded "admob for flash air (admob_all_in_one6.6.7.ane) from this link http://fuji.h1de.net/browse.php?u=Oi...zLw%3D%3D&b=13

2) I added this native extension to my flash cs6 project via advanced actionscript 3 settings -> library path tab.

3) Set my flash target to the air 4.0.01390 for android.

4) I wrote a small class to inialize add....
Expand|Select|Wrap|Line Numbers
  1.     package
  2.     {
  3.       import flash.display.Sprite;
  4.  
  5.     import so.cuo.platform.admob.Admob;
  6.     import so.cuo.platform.admob.AdmobEvent;
  7.  
  8.     public class Interstitial extends Sprite
  9.     {
  10.         var admob:Admob= Admob.getInstance();
  11.  
  12.                 public function Interstitial()
  13.         {
  14.            super();
  15.                 }
  16.  
  17.                 public function displayAdd():void
  18.                 {
  19.            if(admob.supportDevice)
  20.                    {
  21.                         // i have replaced setKeys with my admob ad unit id "ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx"
  22.                    admob.setKeys("a152834c8723912"); 
  23.  
  24.                            admob.addEventListener(AdmobEvent.onInterstitialReceive,onAdReceived);
  25.                 admob.cacheInterstitial();
  26.            }
  27.         }
  28.  
  29.         protected function onAdReceived(event:AdmobEvent):void
  30.         {
  31.             if(event.type==AdmobEvent.onInterstitialReceive){
  32.                 admob.showInterstitial();
  33.             }
  34.         }
  35.     }
  36.  
5) In my main.as class I am calling the displayadd() method like this...
Expand|Select|Wrap|Line Numbers
  1.     var showAdd:Interstitial = new Interstitial();
  2.     showAdd.displayAdd();
  3.  
6) I have added this code to myappname-app.xml
Expand|Select|Wrap|Line Numbers
  1.     <android>
  2.         <manifestAdditions>
  3.            <![CDATA[<manifest>
  4.                <uses-permission android:name="android.permission.INTERNET"/>
  5.                <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  6.            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
  7.                   <application>
  8.              <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 
  9.              </application>
  10.            </manifest>]]>
  11.         </manifestAdditions>
  12.     </android>
  13.  
  14.     <extensions>
  15.         <extensionID>so.cuo.platform.admob</extensionID>
  16.      </extensions>
  17.  
7) published app to my new samsung that uses andriod version 4.2.2

8) no ads display, my app just crashes and de-activates when i call
Expand|Select|Wrap|Line Numbers
  1. var showAdd:Interstitial = new Interstitial();
  2.     showAdd.displayAdd();  
  3.  
have i missed something ?
Feb 22 '14 #1
0 5416

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.