How do i add admob ads in my app ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • luke
    New Member
    • May 2012
    • 14

    How do i add admob ads in my app ?

    Steps that I have taken are listed below...

    1) I have downloaded "admob for flash air (admob_all_in_o ne6.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....
    Code:
        package
        {
          import flash.display.Sprite;
    	
    	import so.cuo.platform.admob.Admob;
    	import so.cuo.platform.admob.AdmobEvent;
    	
    	public class Interstitial extends Sprite
    	{
    		var admob:Admob= Admob.getInstance();
    		
                    public function Interstitial()
    		{
    		   super();
                    }
    
                    public function displayAdd():void
                    {
    		   if(admob.supportDevice)
                       {
                            // i have replaced setKeys with my admob ad unit id "ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx"
           			admob.setKeys("a152834c8723912"); 
                            
                 	          admob.addEventListener(AdmobEvent.onInterstitialReceive,onAdReceived);
    		        admob.cacheInterstitial();
    		   }
    		}
    
    		protected function onAdReceived(event:AdmobEvent):void
    		{
    			if(event.type==AdmobEvent.onInterstitialReceive){
    				admob.showInterstitial();
    			}
    		}
    	}
    5) In my main.as class I am calling the displayadd() method like this...
    Code:
        var showAdd:Interstitial = new Interstitial();
        showAdd.displayAdd();
    6) I have added this code to myappname-app.xml
    Code:
        <android>
            <manifestAdditions>
               <![CDATA[<manifest>
                   <uses-permission android:name="android.permission.INTERNET"/>
                   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    	       <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
                      <application>
    		     <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 
    		     </application>
               </manifest>]]>
            </manifestAdditions>
        </android>
    
        <extensions>
            <extensionID>so.cuo.platform.admob</extensionID>
         </extensions>
    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
    Code:
    var showAdd:Interstitial = new Interstitial();
        showAdd.displayAdd();
    have i missed something ?
    Last edited by luke; Feb 22 '14, 08:37 AM. Reason: forgot code tags
Working...