We've released the new and expanded version 2 of all the ad provider demos. If you already have an earlier version, delete your downloaded copy from %localappdata%\GameMaker-Studio\demo and then download the demo again to get the new versions - GameMaker won't automatically update your existing copy.
You'll find extra functions for positioning/hiding/removing, plus better feedback as a social event is fired so you know if an ad loaded okay/failed/etc, and... the ability to load ads at x/y location.
You can see the full list of new functionality for Google Mobile Ads in the next image:
We've also made the providers as functionally similar as possible. There are of course still differences (as some ad providers don't do interstitials, or Ad Colony only do interstitials and not banners, etc.) but where there is an overlap in what the provider allows we've kept the setup the same. This means you could change from one ad provider to another very easily in your game just by dropping in the new .gmez and then replacing the provider name before the _ in all function names and that would be the only change you'd likely need.
As you go through each demo, please see the readme action in objControl's Create event for more information, plus the various comments throughout the demo. Always start by reading the readme thoroughly, as it will explain if there are any build requirements or obvious pitfalls to be aware of - it also covers the results of our own testing.
Once you've had a read of the readme, run the app on your device and have a press of the buttons. You will find ads load and can be moved, removed, rewards are gained, etc., just fine. If you wish to test using your own ad provider settings the instructions for doing this will be covered in the readme, but for almost all of the providers you would be changing the keys written in that Initialise action in the above image.
As mentioned above and shown in that last image, you will now receive Social events when banners and interstitials change state. In this way you can reposition banners, track rewards, fire a push notification, promote an IAP, or whatever you want. However, be advised also that some providers do not have a system where the ad size is always supplied upfront and in these cases you must use the Social system in order to reposition your add before it becomes visible to your player, otherwise it will always appear at 0,0 - the providers which do this are explicitly covered in their demo.
If you want to see exactly how the extension is made up, or you wish to customise any of the functionality (or add new stuff - the demo is done now and we've matched and even exceeded what GGS and the in-built functions offer on other platforms, so if you want something extra you'll likely have to write it yourself using the provider's own SDK documentation), you will need to explore the source code.
To do this, right-click the extension in the tree and choose Open Extension Directory:
This will open a new Explorer window in the upper folder of your extension location inside the project folder. Inside the folder Explorer is showing you will be subfolders for iOS and/or Android (plus whichever platforms your extension covers, once we add more to the new system):
Inside those folder you will see the structure for the extension, plus the source code itself. Understanding the new languages is far too large a topic to go into here, but you will see Android extensions use Java .java files and iOS uses Objective-C .h header files and .mm implementation files. Feel free to have a read through the code and make changes if you wish.
Once you're happy with testing the demo and you've understood what's going on with the code, you should export the extension out for use in your own project. To do this, you must use the new-style "Studio v1.3" .gmez format, not the legacy GameMaker .gex extension type.
Simply right-click the extension entry in the tree and choose Export extension from the context menu, as shown below:
This will give you a save dialogue, so pick a location and your new file will be written out. Locate the file and you'll be ready for the next stage.
Here is a really simple test project to try out yourself, which should give a solid idea of how to use the extensions. Create a new project, then create one object and add it into an empty room.
Add your extension via right-clicking the Extensions folder in the tree and choosing to Import - note that there is no need to use the old .gex library method to install these extensions.
Next, open your object and add in the events and actions shown in the following three images:
Make an executable of that project and it will toggle between showing two ads of different sizes and different screen locations quite nicely. You will also notice that loading one banner closes any existing banner and frees up the memory used.
So now you've had a look at the demo, figured out how it works, and seen a quick example of how to integrate an extension into a new project. You should hopefully be able to quite quickly drop any of the ad providers into your own game. Note that it's perfectly fine to include multiple ad providers as extensions in one project - iAds for your iOS release, Google for your Android version, for example - as they use unique function names.
The next Early Access release will bring a slight change to the system for creating your own extensions (but that won't affect what we've been over here), plus the automatic generation of empty "stubbed" extension functions when you run on a platform your extension is not selected for in its properties window, so this guide will get another small update at that time.
A few things to be aware of:
If you're stuck with your Android extensions never being found in an .apk, then you might have the EA97/v1344 bug detailed above. Your code will have been imported to the location shown here, when it should be inside the Java folder in order to work in v1344+. Depending on the GM version you started this project in, you may not even have a Java folder and would need to create it manually first - early EA builds wouldn't even have an AndroidSource folder.
You may want to just collect your source code files somewhere else for a moment and then make a new extension and re-import the code, rather than fixing manually.