Adobe Flash Builder 4.7 : Flex Mobile - How to Integrate AdMob - Interstitial 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.
<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.addEventListener(AdEvent.INIT_OK, onEvent);
_admob.addEventListener(AdEvent.INIT_FAIL, onErrorEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_SHOW_OK, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_SHOW_FAIL, onErrorEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onCacheEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_FAIL, onErrorEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_LEFT_APP, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_OPENED, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CLOSED, onEvent);
_admob.init();
//cache interstitial ads here
_admob.cacheInterstitial("ca-app-pub-3940256099942544/1033173712");
}
protected function onEvent(ae:AdEvent):void {
trace(ae.type + " " + ae._data);
}
protected function onCacheEvent(ae:AdEvent):void {
_admob.showInterstitial();
}
protected function onErrorEvent(ae:AdEvent):void {
debugger += ae.type + " " + ae._data;
}
]]>
</fx:Script>
<s:Form>
<s:FormItem label="Error">
</s:FormItem>
<s:TextInput text="{debugger}" editable="false" width="100%"/>
</s:Form>
Hint:"ca-app-pub-3940256099942544/1033173712" is dummy id for test
[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
<![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.addEventListener(AdEvent.INIT_OK, onEvent);
_admob.addEventListener(AdEvent.INIT_FAIL, onErrorEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_SHOW_OK, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_SHOW_FAIL, onErrorEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onCacheEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CACHE_FAIL, onErrorEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_LEFT_APP, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_OPENED, onEvent);
_admob.addEventListener(AdEvent.INTERSTITIAL_CLOSED, onEvent);
_admob.init();
//cache interstitial ads here
_admob.cacheInterstitial("ca-app-pub-3940256099942544/1033173712");
}
protected function onEvent(ae:AdEvent):void {
trace(ae.type + " " + ae._data);
}
protected function onCacheEvent(ae:AdEvent):void {
_admob.showInterstitial();
}
protected function onErrorEvent(ae:AdEvent):void {
debugger += ae.type + " " + ae._data;
}
]]>
</fx:Script>
<s:Form>
<s:FormItem label="Error">
</s:FormItem>
<s:TextInput text="{debugger}" editable="false" width="100%"/>
</s:Form>
as below image.
[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, you device should display like this.
----------------------------->>
Learn more about ANEAdMob: https://github.com/pozirk/ANEAdMob
Thanks you so much :)
ReplyDeleteYou're Welcome :)
DeleteYou've got a misspelled at [Configuration app.xml] step 3
Delete<activity android:name="com.google.android.gms.ads.AdActivity" instead
<activity abdroid:name="com.google.android.gms.ads.AdActivity"
lol xD
OK, i'm ready checked.
DeleteIn my sample project was right but on my post was wrong spell so i adjusted many post of tutorial, thank you so much.
This comment has been removed by the author.
DeleteOne month ago, i used Air SDK 18.0, ANE AdMob works properly. But 3 day ago, i upgraded Air SDK to latest version(20.0). Today all my ads don't appear -_- console say "Network Error"... I've no idea about it. Can you help me? Thanks
DeleteI'll check it tonight and reply also.
DeleteFrom my experience due on last Feb 7 - 9, admob server has problem on size of banner. My app not show any banner too except interstitial still work.
DeleteAnd so I'm create Admob in Animate CC (AIR 20.0), it's work normally. You can try it for free 30 days.
It's mean you can integrate AdMob to app by Animate CC? If so i'll try it soon. Thank you for reply :)
DeleteI've written new Tutorial done for Animate CC + ANE Admob, please check this Animate CC + Admob Banner
DeleteHi, I've found another Admob ANE in here https://github.com/lilili87222/admob-for-flash
DeleteSeem it's easier than pozirk, and upgrade to Air20. Check it :)
Ok, choose the right and easier way you want is best ;)
DeleteBig issues in pozirk's ANE is here android:value="4323000"
DeleteYou can't change any google service version. If you put android:value="@integer/google_play_services_version" => The app can not be built.
If you put a determined value like android:value=8489470 => App will be built, but Ads not show and console throw a log "The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 8489470". I think pozirk should fix and improve this ANE to be better
You mean about "4323000" refer ro your "Network Error", right?
DeleteI'm never got any issue of pizrik's ane admob, my suggest is don't change anything of pozrik ane. just only coding and call any method in actionscript 3.0. You can checkout my sample Apk and Source code, it's not need to change any value in xml.
Game Dev To Died: Adobe Flash Builder 4.7 : Flex Mobile - How To Integrate Admob - Interstitial For Android >>>>> Download Now
Delete>>>>> Download Full
Game Dev To Died: Adobe Flash Builder 4.7 : Flex Mobile - How To Integrate Admob - Interstitial For Android >>>>> Download LINK
>>>>> Download Now
Game Dev To Died: Adobe Flash Builder 4.7 : Flex Mobile - How To Integrate Admob - Interstitial For Android >>>>> Download Full
>>>>> Download LINK 7N
Game Dev To Died: Adobe Flash Builder 4.7 : Flex Mobile - How To Integrate Admob - Interstitial For Android >>>>> Download Now
ReplyDelete>>>>> Download Full
Game Dev To Died: Adobe Flash Builder 4.7 : Flex Mobile - How To Integrate Admob - Interstitial For Android >>>>> Download LINK
>>>>> Download Now
Game Dev To Died: Adobe Flash Builder 4.7 : Flex Mobile - How To Integrate Admob - Interstitial For Android >>>>> Download Full
>>>>> Download LINK uP