Heyzap Mediation Sdk 10 Android/eclipse [tutorial]

Discussion in 'Advertising' started by Christoph, Jan 9, 2017.

  1. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Note:
    If you are looking for the iOS tutorial get it here!

    This tutorial is for Android games compiled in Eclipse. It works with Buildbox 2.2.8 and above which is compatible with Heyzap SDK 10 and above. It's now pretty much straight forward and easy to use Heyzap's mediation service which you can use for rewarded videos, interstitial ads and/or banners. Interested? Just follow this tutorial step by step and you will have set it up in no time:

    1.png
    UNIFIED PLATFORM - Android SDK 10 & Eclipse
    The unofficial Buildbox Tutorial
    PART 1

    BUILDBOX SETUP
    1. Go to https://developers.heyzap.com/account and copy your Publisher ID (if you do not have an account yet, register first for an account at https://www.heyzap.com/register, then copy your ID)
    2. Open your Buildbox game and go to Project Settings/Advertisements
    3. Select Apple Google Play Store as your Application Store
    4. Paste your Heyzap Publisher ID into the corresponding field
    5. Click on OK

    4.png

    IMPORTANT: Do not set up any other Ad Networks here because we will run everything through Heyzap Mediation. Leave all other IDs blank. Do not use any Banners or Interstitial Priority List either.

    6. From the Buildbox Flow Chart page, select an UI box (for example Game Over). Under "Advanced Options" on the right sidebar, choose Heyzap for the "Ad Interstitial" and the "Banner" field. Then set the frequency of the ads and repeat this step for all other menus you want Heyzap Mediation ads to appear (Game Field, Pause Menu, Main Menu).
    [​IMG]

    IMPORTANT: As in the point above, do not set up any other Ad Networks in any of the UIs here. If you do it will mess up with the SDKs and give you error in Eclipse.

    7. Generate your Android project by selecting File/Export/Android.

    6.png

    8. Ignore the Heyzap warning from the pop-up and click on "Continue".

    [​IMG]



    HEYZAP APPLICATION SETUP
    1. Go back to your Heyzap "Dashboard" (https://developers.heyzap.com/dashboard/) and choose "All apps" and "+ Claim an App" at the top of the left side panel.

    2.png

    2. Click on Android and add your app (if it is not yet in the App Store, click on "clicking here" to add it manually)

    3.png


    Note: to get your Android Package name go to https://play.google.com/apps/publish/ and click on your game. The Package name is just beneath the title of your game at the very top. It is important that the package name is correct as Heyzap uses it to connect with your game.



    HEYZAP 3rd PARTY AD NETWORK SETUP
    1. Go to your Heyzap Dashboard Integration Wizard (https://developers.heyzap.com/integration_wizard)

    2. Select the Ad Networks you want to set up and click on “Continue".

    [​IMG]

    Note: I personally recommend to use AdMob, Applovin, Facebook, UnityAds and Vungle. I also know of several publishers who use these exact ad networks because they give the best results at the moment.

    3. Select your App and click on “Continue"
    8.png

    4. Add all your credentials from your 3rd party Ad Networks and click each time on “Continue” (you need to register for each Ad Network and setup your app individually before you’ll get all the information needed). You can easily follow the instructions for each ad network provided by Heyzap and use the links available for each credential and setup.

    Example Admob:
    9.png

    5. After adding all your credentials - and as a final step - choose “Android" in the "SDK Integration” tab.

    10.png


    6. You should have been re-directed to Heyzap Docs Android SDK Setup and Requirements page (https://developers.heyzap.com/docs/ios_sdk_setup_and_requirements) and the Ad Networks you chosen previously should have been selected automatically. If not, select them now again:

    index.png

    7. Now scroll down a little bit and download the latest 3rd-party SDKs (from step 2), but don’t install/add them yet.

    [​IMG]

    Note: we don't need to download the Heyzap SDK since we will use the one provided with Buildbox.

    8. From your download folder on your Computer, select all downloaded zip files and drag and drop them into a new folder called "Heyzap SDKs”.
    13.png
    9. Uncompress all zipped SDKs and select all .jar files you can find. Then copy them to another new folder called “Ready to Install”.

    If you have selected the same ad networks as I did, it looks like that:
    [​IMG]Note 1: As you will see, the provided Facebook SDK now only comes with two .aar files. We need to convert them into .jar files to make them work with Eclipse (aar files are for Android Studio). To do this rename both files to .zip (facebookaudiencenetwork-4.10.0.zip & fyber-facebook-4.10.0-r4.zip). Then use any extractor application to unzip them. In each unzipped folder you will see a classes.jar file. It will look like this:[​IMG]Re-name the file so that it matches the original aar file's name. You will end up with two files called: "facebookaudiencenetwork-4.10.0.jar" and "fyber-facebook-4.10.0-r4.jar". This are the two files we copy into the "Ready to Install" folder.

    Note 2: The folder called "Ready to Install" is not obligatory, but I recommend to do it anyway as with each update or Buildbox export of your game you will need them again and again. So it is very handy to have them ready immediately when you need them.

    10. Leave the Heyzap Docs page in your browser open. We still need it later. Now we are ready to work with Eclipse. :)
     
    Last edited: Jan 11, 2017
  2. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    [​IMG]
    UNIFIED PLATFORM - Android SDK 10 & Eclipse
    The unofficial Buildbox Tutorial
    PART 2

    ECLIPSE SETUP
    1. Open Eclipse

    2. Import your exported Android file by right clicking on the white space from the Package Explorer and choose “import” from the pop-up window.

    index-3.png


    3. Select “Android/Existing Android Code Into Workspace” and click “Next >”.

    index-4.png

    4. Then "Browse…" to your Root Directory of your game (this is the folder you exported from Buildbox) and click on “Finish”. The game gets now loaded into Eclipse.
    index-5.png

    Note:
    After the loading finishes completely there shouldn’t be any errors. If there are you must first setup Eclipse correctly!!! If you have warnings (the yellow signs) this is normal and you can ignore them.

    5. In the Package Explorer click on your game folder (com.yourcompany.yourgame) and unfold the libs folder. It should look like that:

    index-6.png


    6. Now copy all the files from your “Heyzap Bundle Android” folder to the libs folder from Eclipse.

    16.png


    A pop-up window appears (File Operation). Select “Copy Files” and click on "OK".
    index-7.png
    IMPORTANT: If you use Vungle, you also will notice that you now have two dagger.jar files in the libs folder. Delete the older one (dagger-1.2.2.jar).

    7. Now open the AndroidManifest.xml (double click on it) and go to the Manifest tab (2)

    index-8.png

    As always set up your “Version Code” and “Version Name” (3 & 4).

    Then also choose “Auto” from the Install location drop down (5). Note: this is optional but it allows users to decide where to install the game (on device or SD card) + it adds a new permission (WRITE EXTERNAL STORAGE) which we need anyway for AppLovin or Vungle.

    8. Go to the “AndroidManifest.xml” tab (1) and search for the code <application (it’s the 7th line) (2). Click with your mouse just after it and hit two times enter. Then add this code:

    Code:
    android:hardwareAccelerated="true"
    index-9.png

    9. Now scroll down in the AndroidManifest.xml until you find <!-- FACEBOOK SDK -->. This and the following ones are the activities Buildbox already set up. For the mediation purpose we need to add some more though (or change some), therefore select everything between </activity> and </application> and then delete the entire code.

    Example of the code you need to delete:
    index-10.png

    10. Leave the mouse cursor in its place and everything open. Then go back to the Heyzap Doc in your browser. In step 3 of the Doc you’ll find the ACTIVITIES you need for your chosen ad networks.
    If you have selected the same ad networks like I did then it looks like that in the Heyzap Doc page:
    heyzap.png

    Copy the entire code, go back to Eclipse and paste it in the exact same place you left in the step before (between </activity> and </application>)

    Note:
    As you can see, for AppLoving you need to ad YOUR SDK KEY within the code once pasted in Eclipse. Don't forget that.

    11. For some 3rd party Ad Networks we need to set up new Permissions. To make this happen, scroll even further down in the AndroidManifest.xml till you see this code:
    <uses-permission android:name="android.permission.INTERNET" />

    12. Go back to the Heyzap Doc page and in the same step 2 where you found the activities (just a little bit above) you'll find the permissions that need to be added. I recommend to add both, mandatory and optional permissions (if you have them). In my case my Heyzap doc page looks like that:

    [​IMG]

    Copy the entire code and paste it beneath the last permissions in Eclipse.

    13. This step is not necessary but recommended:
    Go to the Permissions tab and you’ll see that you have now a lot of permissions set up. Most players of your game will not like it because they all need to be approved once they install your game. Therefore, it's recommended to delete the ones we don’t need mandatorily.

    Namely:
    ACCESS_WIFI_STATE,
    ACCESS_COARSE_LOCATION
    READ_PHONE_STATE
    Select them and click on “Remove…”

    [​IMG]

    14. This step is very IMPORTANT: Click CMD+S (Mac) or CTRL+S (Windows) to save the Android Manifest. There is a * in front of the name and once you saved the file it will go away. Make sure you save it!!!


    And this is it, you just set up Heyzap Mediation for your Android Game. Export your APK and test on your device.
    Congratulations!!!!
     
    Last edited: Jan 10, 2017
    Bilz636, Two Frogs and Mike A. like this.
  3. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    ADDITIONAL SETTINGS
    One last thing to consider is to check and adjust the publisher settings in your Heyzap Dashboard.
    Select your app on the top left corner and go the the "Publisher Settings" tab.

    index-7.png


    Here you can adjust how the ads behave.

    In the tab "Mediation Settings" you can see if your Ad Networks are set up correctly (green). If anything is wrong with your setup you can correct it there as well.


    TEST YOUR 3rd-PARTY INTEGRATIONS
    The mediation SDK comes with a Mediation Test Suite that you can use to test each of the networks you've chosen (and its different ads like banner, interstitial, rewarded video). It is recommended to use this test suite so you don't click on your own ads which we all know is not well seen by the ad networks).

    To use the Mediation Test Suite you need to call the TestActivity method after starting the SDK:

    1. Go to com.yourcompany.yourgame/src/com.secrethq.ads/ and open "PTAdHeyzapBridge.java" with a double click

    index.jpg

    2. Scroll down (approximately 2/3rd of the file) and search for this code:
    public static void startSession( String sdkKey ){

    3. After the start activity hit enter and paste this code:

    Code:
    HeyzapAds.startTestActivity(PTAdHeyzapBridge.activity);
    It will look like that:
    index-9.png

    4. Click CMD+S (Mac) or CTRL+S (Windows) to save the PTAdHeyzapBridge.java file.

    5. Export your APK and test on your device. When opening your game the Test Suite should start now automatically. It looks like this:
    TestSuiteNetworkListAndroid.png
    Green means everything is setup correctly. Red means it's not. To test a specific ad you need to "Fetch" it first, then you click on "Show". If it gives you an error it means something is not setup properly in the Heyzap Dashboard. Double check as well all steps from this tutorial.

    IMPORTANT: This code should be used for testing purpose and is for temporary use only. Once everything is working as it should, delete the code from step 3 again, save the PTAdHeyzapBridge.java file again and export a new build of your APK. Do NOT upload any build with the code enabled to the Play Store!!!
     
    Last edited: Jan 11, 2017
    Mike A. likes this.
  4. gheorghe9512

    gheorghe9512 Boxer

    Joined:
    Dec 20, 2015
    Messages:
    70
    Likes Received:
    46
    [Quote = "Christoph post: 46713, membru: 874"] Lucrări în curs. Va termina mâine. [/ Quote]
    it is not full tutorial ?
     
  5. Fer Zheng

    Fer Zheng Boxer

    Joined:
    Oct 10, 2015
    Messages:
    29
    Likes Received:
    16
    Lol didn't know about the renaming and extrating method for the .aar files, im gonna try it and see what happens :p
     
    Christoph likes this.
  6. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Finished now! Enjoy.
     
  7. gheorghe9512

    gheorghe9512 Boxer

    Joined:
    Dec 20, 2015
    Messages:
    70
    Likes Received:
    46
    thanks
     
  8. gheorghe9512

    gheorghe9512 Boxer

    Joined:
    Dec 20, 2015
    Messages:
    70
    Likes Received:
    46
    I have a problem after video appears bottom the banners disappear is not appear until you not restart the game.
    please help me !
     
    Christoph likes this.
  9. Fer Zheng

    Fer Zheng Boxer

    Joined:
    Oct 10, 2015
    Messages:
    29
    Likes Received:
    16
    Happens to me too, i think it's a bug
     
    Christoph likes this.
  10. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Thanks for the feedback guys, I'm checking this with Heyzap directly. It happens to me as well.
     
  11. Dr. Jekyll

    Dr. Jekyll Boxer

    Joined:
    Nov 28, 2016
    Messages:
    14
    Likes Received:
    7
    Hi Christoph, first of all thank you very much for this amazingly detailed tutorial, we've eagerly been wating for this! Unfortunately we have the same problem. The banner disappears once an interstitial or reawarded video has been shown. On top of that the banner doesn't scale probably on tablets and it seems to make the game laggy. Thanks a lot for checking with Heyzap!
     
  12. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Got back from Heyzap. They are investigating the issue. Will keep you guys posted.
     
  13. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    I have a gain problems with my emulators so I can't check it myself. But Heyzap support told me this:

    Looks like you need to add `android:configChanges="screenSize|orientation"`
    on your `.PTPlayer` activity manifest entry.

    Can you please try and report back?
     
  14. harislatif

    harislatif Avid Boxer

    Joined:
    Oct 8, 2016
    Messages:
    290
    Likes Received:
    63
    Could u pls tell that where to place that code and if I'm debugging in iOS than how?
     
  15. harislatif

    harislatif Avid Boxer

    Joined:
    Oct 8, 2016
    Messages:
    290
    Likes Received:
    63
    I was thinking that to implement rewarded video ads or video ads were too easy but they aren't so I suggest Buildbox to make this easy process just easy as drag and drop no need for downloading that and that not writing any single line of code!
    C'mon Buildbox if u r seeing this than pls do something in your next updates with this!!!
     
  16. harislatif

    harislatif Avid Boxer

    Joined:
    Oct 8, 2016
    Messages:
    290
    Likes Received:
    63
    @Christoph well dude I have a question can we show video ads not rewarded video ads during random time in game?That is like if a person is playing my game and if he died 9 times for example,so there should be a video ad automatically appearing and than again if died after 17 times one more video ad should come?Is this possible with Buildbox or does this also requires coding knowledge or sdk installation and all that stuff,etc!
     
  17. harislatif

    harislatif Avid Boxer

    Joined:
    Oct 8, 2016
    Messages:
    290
    Likes Received:
    63
    @Christoph your reply will be much appreciated sir!
     
  18. minibraun

    minibraun Boxer

    Joined:
    Dec 22, 2016
    Messages:
    13
    Likes Received:
    13
    Awesome tutorial Christoph.
    To save everyone a lot of frustration here is one more critical step I found in order for everything to work.

    If you followed Christoph's tutorial and activated the Test suite you may find it stuck on this message:
    "Searching for third party network adapters"

    If you think you did everything right, this is probably the reason for it:
    Since Fyber acquired Heyzap there have been some changes starting with SDK 10.
    SDK 10 uses Fyber's servers, while prior versions use Heyzap's. But your Heyzap credentials are transfered to Fyber only when you fill out Heyzaps Ads Payout settings.

    In order for Heyzap and its mediation to work, you must fill out Heyzap's Ads Payout settings.
    (and it will start working in a couple of days)


    Once you enter all the info, the TestSuite will start to work in a couple of days, but it will show all ad networks as not working, only detecting the SDKs but not the configuration files and failing to start any SDKs.

    In a couple of more days, you will receive an email from Fyber asking you for basic info about your app. Once you send that info, your app will instantly start working properly, with the Test Suite showing all the integrated networks correctly.

    Then you will cheer in joy to see your reward videos working.

    The whole process took around 5 days in my experience, it may be different for you guys.
     
  19. wesam_badr

    wesam_badr Miniboss Boxer

    Joined:
    Oct 10, 2015
    Messages:
    1,065
    Likes Received:
    479
    yes i just received an email state that asking me this information they said for security reason the process become more complicated and if the app is new they also ask to know also some info about it with the monetization plan of your game.
    • App store URL of this app
    • App's number of daily active users (DAU)
    • Ad formats you wish to integrate
    • App uses a virtual currency (yes/no)
    • App is a loyalty app (yes/no)
     
    Christoph likes this.
  20. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Ok guys, here's an interesting thing for all users implementing Heyzap Mediation into their games!!!!

    ATTENTION FOLKS!

    I got this from Heyzap today:
    This basically means it is better to use the old tutorials (SDK 9) again for implementing Heyzap Mediation. If you have problems, crashes or whatever else is not working then please do so. Heyzap DOCs page has now again the option to change between the two SDKs. See at the top of the page here: https://developers.heyzap.com/docs/android_sdk_setup_and_requirements
     

Share This Page