Tutorial: Using Heyzap Godot Module (Android Only)
Autor: Shin-NiL | Publicado: 2017-03-19T17:57:00-03:00


















&nbsp;

In this little tutorial, I'll explain how to use the Heyzap module for Godot. Heyzap not only appears as one more option to display ads on Godot, but also has some unique features as well as great support. For more details, visit the official website.&nbsp;



Step 1

Download and compile the Heyzap Module for Godot from this repository. For more information about this process, consult the official documentation and the compiling notes from here.



Note: if you don't want to compile the module by yourself, here's the binaries files I've compiled, use it at your own risk:

Release Template - Heyzap 9.7.1, Godot 2.1.2 (armv7)
Release Template - Heyzap 9.7.1, Godot 2.1.2 (armv7 &amp; x86)




Step 2&nbsp;
Edit the project engine.cfg file and add the following two lines: 
[android]
modules="org/godotengine/godot/Heyzap"
&nbsp;

Step 3

On the project export settings, edit the Custom Package and locate the Heyzap module template file (from step 1).





Step 4

The mandatory permissions are already configured, the following permissions are not required to function, but including may result in improved eCPM and user experience:



Optionally used by InMobi:
GET_TASKS

Optionally used by InMobi:
ACCESS_COARSE_LOCATION

Optionally used by InMobi:
ACCESS_FINE_LOCATION

Optionally used by Chartboost, and InMobi:
ACCESS_WIFI_STATE

Optionally used by InMobi:
CHANGE_WIFI_STATE

Optionally used by InMobi:
READ_CALENDAR

Optionally used by Chartboost:
READ_PHONE_STATE

Optionally used by InMobi:
RECORD_AUDIO

Optionally used by InMobi:
VIBRATE

Optionally used by InMobi:
WRITE_CALENDAR



Step 5

Now you'll be able to use the module functions on your scripts. To see the full functions and callbacks available, check the README file. 




The Heyzap module comes with a "Mediation Test Suite" that you can use to test each of the networks you've chosen. Let's use it:

extends Node

var heyzap = null
var publisher_id = "YOUR HEYZAP PUBLISHER ID"

func _ready():
 if(Globals.has_singleton("Heyzap")):
  heyzap = Globals.get_singleton("Heyzap") # get the Heyzap singleton
  heyzap.init(get_instance_ID(), publisher_id) # init Heyzap

# connected to a button on the main scene
func _on_button_pressed():
 if heyzap:
heyzap.startTestActivity(); # call the mediation test suit




Pressing the scene button, you'll launch the test suite&nbsp; and see something like this:





With that you can verify that each network you want to use has the correct credentials and shows ads correctly.

With the module initialized, you can call any of the functions and callbacks listed here. If you want to show a banner on top of the screen, just call:&nbsp;

heyzap.loadBanner(true)
&nbsp;
or if you want to show a interstitial, simply call:

heyzap.displayInterstitial()
&nbsp; 
and so on. Please check this demo project to see a more complete sample.

 Final notes 
This module is Android only, so you'll won't be able to run it on your computer inside Godot editor. You'll need to export to a real device or Android emulator for that.&nbsp;&nbsp;

If you get any trouble, don't forget, logcat is your friend. Connect to your device and run via command line:
adb logcat -s godot


Was this post useful for you? Feel free to buy me a beer, or a coffee :P


<input name="encrypted" type="hidden" value="-----BEGIN PKCS7-----MIIHNwYJKoZIhvcNAQcEoIIHKDCCByQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCaLRzDMhywYU2r+N452GrB4IZjEtcpu2/LmPeE/sqNvDu5kRjc5B6lap5hmVFttzjJTiB+LpNIzhUSIDoRqDboXfy1vgMv0O8J/OXPgQ7FtVqzQab1opu5L3s7tZRhTsu/X3OrTjQ4wLl6JJQPaVywsbbGhZZNY5a0YX+FfuMk9TELMAkGBSsOAwIaBQAwgbQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIjNZKOWj94U+AgZAfeW30o8eoZuL8H2yr/RI+s2O07PWu3GS981tX5ofpfU/5v6c+Z43tcsfVD4E8Tjy58vKQGaO1G5Er/FD2bB8DfvNI7ooHeKUiXmQmjhA01uhtfJ38jvvViOPFMH8MbgBCs/PDiStReSgH1D+MIb9RTvPL5NJJXfx1DxoHYqDXptnyRqteNDGNnsBVYQztesagggOHMIIDgzCCAuygAwI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