Starling, FlashDevelop, Android and Me (Ad Implementation a la MilkMan Games)


Perhaps I’m the last n00b to fall off the indie pumpkin wagon; I’ll admit that I’m a novice and I learned everything through annoying people, banging my head to a bloody pulp and having a Vegas level hangover the following morning. Implementing ads is not easy; allow me to amend that: implementing ads is not easy for someone who is a novice and works with Flashdevelop.

‘Why use FD’, a brutal, yet subtle voice will sarcastically mock and then take a shit somewhere in the furthers corner of one’s brain while pointing to other IDEs.

Because FD is awesome. It seriously is and can help fledgling coders learn more efficiently with auto complete and better traces. Pros: It’s free. Cons: It’s Windows only and it’s VERY difficult to implement ads due to .bat file navigation. Thus, here we are. I bit the bullet and bought Milkman Games Admob ANE.

 

How To Implement Milkman Admob ANE with Starling/FlashDevelop

Note: If you’re like me, you probably read the following tutorial and realized no matter how hard you tried, it doesn’t work.  It’s okay; after talking to Alex at MilkMan, I took a sigh of relief. The condensed version: FD is difficult to work with any ANY Admob ANEs. The good folks at MMG have one for paying customers.

1. Contact MilkMan support and ask for the fdExtensionTemplate.

another note: In the wild wild cyberworld where everyone is looking for a bargain, I realized it pays, in man hours and sanity, to just cough up the dough to have support and questions answered. Since I respect all the help given to me, I won’t post the template here. Please support folks like MMGs; they are the back bone of new indie developers. I wasn’t paid to tout them, I am just appreciate since they walked me through the ad implementation process.

2. Unzip the fdExtensionTemplate and place it in the following folder: C:/Users/YOURUSERNAME/AppData/Local/FlashDevelop/Projects.

3. Restart FD and create a new project using the new ‘Air Mobile AS3 App Ex’ option at the bottom of the project list.

4. Take both GoogleService.ane and Admob.ane and paste them in the ext folder.

5. Right click both GoogleService.ane and Admob.ane and select ‘Add to Library’.

6. Right click both GoogleService.ane and Admob.ane again and select Options -> External Library (not included). This will place the .anes in the ‘ext – temp’ folder.

7. “Grab a Draaaaaank”. –  Chris Leavins

8. Modify you application.xml to that shown in the tutorial. If you’re using Starling, this is extremely important, since it won’t work if the application.xml isn’t modified.

9. Head over the Admob, set up your profile and ad preference.

10. Copy your publisher ID and place it in the following function that SHOULD be in  your Main.as:

if(AdMob.isSupported)

{

  AdMob.init("YOUR_PUBLISHER_ID"); <----- [PID goes here]

}

else

{

  trace(“AdMob only runs on Android.”); return;

}

11. Modify your CreateCertificate.bat / SetupApplication.bat passwords as preferred.

12. Create your certificate. Only needs to be done once.

13. Run PackageApp.bat and build your apk.

14. Test before submitting to GooglePlay store.

****

Trouble Shooting:

1.” I can’t see my ads!”

A: MMG Admob only works on android/ios devices. They will not work on any rig. Check out previous tutorial on how to set up your devices to develop in the FD/Android environment.

<>

2. “I’m getting the following error: ReferenceError: Error #1065: Variable Admob is not defined.”

A: This usually means that the <extensionID> is not updated in the application.xml. To fix this, place the following after <icon>.

<extensions>
        <extensionID>com.milkmangames.extensions.AdMob</extensionID>
        <extensionID>com.milkmangames.extensions.GoogleServices</extensionID>
        </extensions>

This usually fixes the problem as well as updates the Adobe tutorial. Yes, both are needed.

<>

3. Google won’t accept my app! It says it’s still in Debug…etc.

A: Before building, set the builder to ‘Release’ instead of ‘Debug’. The drop down is located underneath ‘Tools’ and ‘Macros’ in the menu options.

As always, test, test, test and then submit. Enjoy!

 

***

If this tutorial helped you out, I’m not above asking for tips!

Bitcoin: 1zcqAZaq99XYnWdDCWsYEVX4rwb5ikyvz

Doge: DKERrZi1VLbaJovo6xFWz76dQq3826DP93

And if you want to help my indie adventure, please play Sol Del Ray.