Adobe Flash Builder 4.7 : Flex Mobile - How to Integrate AdMob - Banner for Android
Test on:
- Mac OSX Yosemite
- Adobe Flash Builder 4.7
- Adobe AIR SDK 4
- Adobe AIR SDK 4 Compiler
- Asus Zenfone 4.5
- ANEAdMob Build3.6 : http://sh.st/U5NlH
[Sample Source Code]
Apk file:
Fxp file:
[Pre-Require]
download and install from any their instructions.
- Adobe Flash Builder 4.7
http://www.adobe.com
- Adobe AIR SDK [3.6 or Above]
[version 3.6]
http://airdownload.adobe.com/air/mac/download/3.6/AdobeAIRSDK.tbz2
- Adobe AIR SDK and Compiler [3.6 or Above]
[version 3.6]
http://airdownload.adobe.com/air/mac/download/3.6/AIRSDK_Compiler.tbz2
[all version]
https://helpx.adobe.com/air/kb/archived-air-sdk-version.html
- ANEAdMob
https://github.com/pozirk/ANEAdMob
- Update the AIR SDK for ActionScript Projects | Flash Builder 4.7
https://helpx.adobe.com/flash-builder/kb/overlay-air-sdk-flash-builder.html
Test on:
- Mac OSX Yosemite
- Adobe Flash Builder 4.7
- Adobe AIR SDK 4
- Adobe AIR SDK 4 Compiler
- Asus Zenfone 4.5
- ANEAdMob Build3.6 : http://sh.st/U5NlH
[Pre-Require]
download and install from any their instructions.
- Adobe Flash Builder 4.7
http://www.adobe.com
- Adobe AIR SDK [3.6 or Above]
[version 3.6]
http://airdownload.adobe.com/air/mac/download/3.6/AdobeAIRSDK.tbz2
- Adobe AIR SDK and Compiler [3.6 or Above]
[version 3.6]
http://airdownload.adobe.com/air/mac/download/3.6/AIRSDK_Compiler.tbz2
[all version]
https://helpx.adobe.com/air/kb/archived-air-sdk-version.html
- ANEAdMob
https://github.com/pozirk/ANEAdMob
- Update the AIR SDK for ActionScript Projects | Flash Builder 4.7
https://helpx.adobe.com/flash-builder/kb/overlay-air-sdk-flash-builder.html
- Overlay AIR SDK on Flex SDK | Flash Builder
[Create Flex Mobile Project]
1. Open Adobe FlashBuilder and goto File > New > Flex Mobile Project
[Add ANEAdMob]
1. Right-click on project name and choose "Properties".
2. Goto menu "Flex Build Path" and click on tab "Native Extensions" then click "Add ANE..." and "Browse..." to "ANEAdMob/AdMob.ane", click "OK".
3. On menu "Flex Build Path" and click on tab "Library path" then click "Add SWC..." and "Browse..." to "ANEAdMob/air/AdMob/bin/AdMob.swc", click "OK".
2. finding after "</initialWindow>" add
For call ane extension like below image.
[Sample Source Code]
Apk file:
Fxp file:
It's work!! ;)
----------------------------->>
Learn more about ANEAdMob: https://github.com/pozirk/ANEAdMob
[Create Flex Mobile Project]
1. Open Adobe FlashBuilder and goto File > New > Flex Mobile Project
2. On tab "Project Location", gave Project name "AdmobFlexAIR", leave checked "Use default location" and "Use default SDK (currently *Flex 4.6.0)" then click "Next >"
3. On tab "Mobile Settings" choose "Permissions" and select Platform "Google Android", under Permission list check on
[/] "INTERNET"
[/] "ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE"
then, leave other as default and click "Finish".
1. Right-click on project name and choose "Properties".
2. Goto menu "Flex Build Path" and click on tab "Native Extensions" then click "Add ANE..." and "Browse..." to "ANEAdMob/AdMob.ane", click "OK".
3. On menu "Flex Build Path" and click on tab "Library path" then click "Add SWC..." and "Browse..." to "ANEAdMob/air/AdMob/bin/AdMob.swc", click "OK".
[Configuration app.xml]
1. Click on "AdmobFlexAIR-app.xml" at this line
<application xmlns="http://ns.adobe.com/air/application/4.0">
the number should be at least "3.6" or above, this sample is "4.0"
2. finding after "</initialWindow>" add
<extensions>
<extensionID>com.pozirk.ads.AdMob</extensionID>
</extensions>
For call ane extension like below image.
3. finding after permission of "ACCESS_WIFI_STATE" add
<application>
<meta-data android:name="com.google.android.gms.version" android:value="4323000" />
<!-- should be android:value="@integer/google_play_services_version" -->
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
as below images.
[Implement AdMob in mxml]
1. Open "AdmobFlexAIRHomeView.mxml" and add line
creationComplete="Main()" in <s:View ... > as below image.
2. After </fx:Declarations> add code
<fx:Script>
<![CDATA[
//...scripting AdMob goes here...
import com.pozirk.ads.admob.AdEvent;
import com.pozirk.ads.admob.AdMob;
import com.pozirk.ads.admob.AdParams;
[Bindable]
private var debugger:String = "";
protected var _admob:AdMob = new AdMob();
public function Main():void {
_admob.init();
_admob.addEventListener(AdEvent.INIT_OK, onEvent);
_admob.addEventListener(AdEvent.INIT_FAIL, onEvent);
_admob.addEventListener(AdEvent.BANNER_SHOW_OK, onEvent);
_admob.addEventListener(AdEvent.BANNER_SHOW_FAIL, onEvent);
_admob.addEventListener(AdEvent.BANNER_LEFT_APP, onEvent);
_admob.addEventListener(AdEvent.BANNER_OPENED, onEvent);
_admob.addEventListener(AdEvent.BANNER_CLOSED, onEvent);
debugger = _admob.toString();
// showing here
_admob.show("ca-app-pub-3940256099942544/6300978111", AdParams.SIZE_SMART_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_MIDDLE);
}
protected function onEvent(ae:AdEvent):void {
trace(ae.type + " " + ae._data);
debugger += ae.type + " " + ae._data;
}
]]>
</fx:Script>
<s:Form>
<s:FormItem label="AdEvent">
<s:TextInput text="{debugger}" editable="false" width="75%"/>
</s:FormItem>
</s:Form>
as below image.
Hint:"ca-app-pub-3940256099942544/6300978111", is dummy id for test only.
[Deployment and Testing]
1. Connect your Android device with usb cable and don't forget to change mode to "usb debugging" and "unknown resource"
2. Goto menu "Project > Export Release Build..."
3. The "Export Released Build" window shows up, set or leave any filed similar as below, don't forget to unchecked section "Target platforms" on "Apple iOS", click "Next >".
4. On "Deployment" tab, checked "install and launch application on any connected devices" and select "Export application with captive runtime".
5. On "Digital Signature" browse to your certificate.p12 file, if you don't have it just "Create..." new one (I'm not cover this part). Then type your password of p12 file when did you created.
6. On "Package Contents" make sure you have checked 2 files of Included files.
7. On "Native Extensions" tab make sure your "AdMob.ane" was checked under "Package". Then click "Finish" and waiting until app launch on Android device.
8. If anything goes well, your device should display like this.
----------------------------->>
Learn more about ANEAdMob: https://github.com/pozirk/ANEAdMob




















thanks for sharing
ReplyDeletehow can I add Admob in flash builder 4.5
FB 4.5 not have menu "Native Extensions" try with this method from adobe: "Using Flash Builder 4.5.1 to compile an AIR App that uses a native extension" OR this video tutorial "FB 4.5 - How to use an ANE"
DeleteNice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share. blackmart apk new version _ APK For All
ReplyDeleteTook me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! MOBILE
ReplyDeleteรีวิวเกมส์
ReplyDeleteรีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์
รีวิวเกมส์