Search Unity

Admob Unity Plug-in use Google Play Services, support Interstitial

Discussion in 'Android' started by VNTIS, Mar 24, 2014.

?

Interest plug-in?

  1. yes

    174 vote(s)
    96.1%
  2. no

    7 vote(s)
    3.9%
  1. miandmian

    miandmian

    Joined:
    Jul 1, 2014
    Posts:
    2
    Error building Player: Win32Exception: ApplicationName='D:/adt-bundle-windows-x86_64-20140624/sdk\tools\zipalign.exe', CommandLine='4 "D:\project\mache8ss\Temp/StagingArea/Package_unaligned.apk" "D:\project\mache8ss\Temp/StagingArea/Package.apk"', CurrentDirectory='Temp/StagingArea'
     
  2. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    see the first page for more imformation :)
     
  3. TheStarboxTR

    TheStarboxTR

    Joined:
    Mar 22, 2014
    Posts:
    7
    Hİ dude ı have a prolem.
    what ı have to write "YOUR_AD_UNIT_ID" ?
    my admob publisher id or my admob Ad unit ID ?

    pub-7138106987830459 or ca-app-pub-7138106987830459/3949790525 ?
     
  4. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    ca-app-pub-7138106987830459/3949790525
     
  5. TheStarboxTR

    TheStarboxTR

    Joined:
    Mar 22, 2014
    Posts:
    7
    thank you so much dude ı am gonna think about buy pro version of your plugin for interstital :)
     
  6. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    you are welcome
     
  7. KholdStare2399

    KholdStare2399

    Joined:
    Jun 29, 2014
    Posts:
    3
    When I put an AdmobVNTISObject into the scene I get the following error when running the game and no ads appear on the screen.

    "
    Exception: JNI: Init'd AndroidJavaClass with null ptr!
    UnityEngine.AndroidJavaClass..ctor (IntPtr jclass) (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:539)
    UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:517)
    UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:508)
    UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Object[] args) (at C:/BuildAgent/work/d63dfc6385190b60/Runtime/Export/AndroidJavaImpl.cs:110)
    UnityEngine.AndroidJavaObject..ctor (System.String className, System.Object[] args) (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/AndroidJava.cs:17)
    AdmobVNTIS.Awake () (at Assets/AdmobVNTIS/AdmobVNTIS.cs:64)
    "
     
  8. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    build and run it on REAL device. (not editor)
     
  9. GhulamJewel

    GhulamJewel

    Joined:
    May 23, 2014
    Posts:
    333
    quick question if I would like the interstitial ad to appear when game is over how would I do that? like whenever a gameobject is destroyed a ad is loaded.

    this is what happens when game is ended another script is called

    void OnDestroy()
    {
    // Game Over.
    transform.parent.gameObject.AddComponent<GameOverScript> ();
    }

    thank you.
     
    Last edited: Jul 20, 2014
  10. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    Put Interstitial Prefab on the first scene, but uncheck ShowInterstitialOnLoad

    and in your script:

    void OnDestroy()
    {
    // Game Over.
    transform.parent.gameObject.AddComponent<GameOverScript> ();
    AdmobVNTIS_Interstitial x = (AdmobVNTIS_Interstitial)GameObject.Find("AdmobVNTISInterstitialObject").GetComponent ("AdmobVNTIS_Interstitial");
    x.showInterstitial ();
    }

    Notice: the prefab and script cause error in Unity Editor, use it when you build apk for real device
     
  11. GhulamJewel

    GhulamJewel

    Joined:
    May 23, 2014
    Posts:
    333
    Does that mean old apps will stop displaying ads?
     
  12. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
  13. Andysign

    Andysign

    Joined:
    Jul 12, 2014
    Posts:
    2
    Hi VNTIS I will like you to help me to put this on the right way, Interstitial add only shows once per section, I have been reading comments and I saw welly_59 had the same issue and I did the same, I removed

    Code (CSharp):
    1. // Dont destroy on load and prevent duplicate
    2.     private static bool created = false;
    3.     private static bool paused = false;
    4.     void Awake() {
    5.         if (!created) {
    6.             DontDestroyOnLoad(this.gameObject);
    7.             created = true;
    8.         } else {
    9.             Destroy(this.gameObject);
    10.         }
    11.     }
    12.     //
    But after doing this, adds didn't shown any longer, not even from the beggining, why did this happen? :( am I doing something wrong?

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class AdmobVNTIS_Interstitial : MonoBehaviour {
    5.  
    6.     public string PublisherID = "YOUR_AD_UNIT_ID";
    7.     public string TestDeviceID = "";
    8.     public bool ShowInterstitialOnLoad = true;
    9.  
    10.     private static AndroidJavaObject jo;
    11.  
    12.     void initializeInterstitial(){
    13.         jo = new AndroidJavaObject ("admob.admob",PublisherID,TestDeviceID,ShowInterstitialOnLoad);
    14.     }
    15.  
    16.     /// <summary>
    17.     /// Load and show the interstitial.
    18.     /// </summary>
    19.     public void showInterstitial(){
    20.         jo.Call ("showInterstitial");
    21.     }
    22. }
    23.  
    Is this the way it should looks like?
     
  14. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class AdmobVNTIS_Interstitial : MonoBehaviour {
    5.  
    6.     public string PublisherID = "YOUR_AD_UNIT_ID";
    7.     public string TestDeviceID = "";
    8.     public bool ShowInterstitialOnLoad = true;
    9.  
    10.     private static AndroidJavaObject jo;
    11.    
    12.     //Start is missing
    13.     void Start(){
    14.           initializeInterstitial();
    15.     }
    16.  
    17.     void initializeInterstitial(){
    18.         jo = new AndroidJavaObject ("admob.admob",PublisherID,TestDeviceID,ShowInterstitialOnLoad);
    19.     }
    20.  
    21.     /// <summary>
    22.     /// Load and show the interstitial.
    23.     /// </summary>
    24.     public void showInterstitial(){
    25.         jo.Call ("showInterstitial");
    26.     }
    27. }
    28.  
    You need Awake or Start to call initializeInterstitial() which create the ad
     
  15. TSSTUDIOS

    TSSTUDIOS

    Joined:
    Jun 10, 2013
    Posts:
    15
    Not working for me, done everything on the instructions, btw why is there no refresh rate settings? cuz its based on the admob banner setting ?
     
  16. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    need more information.
    you can change refresh rate from Admob website.
     
  17. TSSTUDIOS

    TSSTUDIOS

    Joined:
    Jun 10, 2013
    Posts:
    15
    ok i got it to work

    i set it up on my main menu only, it takes around 30 seconds to show up,i got the show on load option checked but it does not work, so basicly, if when i load my main menu and click play to go into my game scene right away without waiting for ads it wont show ads throughout the game, my current problem is how to make it load it right away, cuz my scenes get complete in less then 30 secs
     
  18. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    ad need time to load. Do you change the code? It should be show throughout the game.
    Dont Destroy On Load must be available in the code.
     
  19. KiraboJump

    KiraboJump

    Joined:
    Jul 24, 2014
    Posts:
    1
  20. Andysign

    Andysign

    Joined:
    Jul 12, 2014
    Posts:
    2
  21. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    2x 5 stars :p
     
  22. TSSTUDIOS

    TSSTUDIOS

    Joined:
    Jun 10, 2013
    Posts:
    15
    havent changed a single thing in the code
     
  23. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    Contact me taquangtien92@gmail.com for support. (Team Viewer)
     
  24. TSSTUDIOS

    TSSTUDIOS

    Joined:
    Jun 10, 2013
    Posts:
    15
  25. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
  26. TSSTUDIOS

    TSSTUDIOS

    Joined:
    Jun 10, 2013
    Posts:
    15
    :) btw i was thinking, wouldnt it be cool to have like a function like if user clicks on add disable ads until next app restart, just giving ideas
     
  27. renezuidhof

    renezuidhof

    Joined:
    Oct 25, 2013
    Posts:
    3
  28. murteas

    murteas

    Joined:
    Feb 14, 2012
    Posts:
    62
  29. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    i am thinking about it. :)

    rated bros. @murteas: there is paypal link in the 1st post, thank you for using my plug-in
     
  30. PeterGary

    PeterGary

    Joined:
    Jul 31, 2014
    Posts:
    1
    Last edited: Jul 31, 2014
  31. Arcanebits

    Arcanebits

    Joined:
    Dec 18, 2013
    Posts:
    66
    Just got the Pluging, going to test.
    If it works I promise will pay the double you ask, and promote it has hell

    Aldo
     
  32. damianbarcena

    damianbarcena

    Joined:
    Jun 12, 2014
    Posts:
    2
    Hi VNTIS, The plugin works great. I was a problem. When the game ends, I show one Interstitial ad. The problem is that sometimes it takes to load the player and select the option "play again". Once we started playing again, the ad is shown interrupting the game. There any way to close the ad if not showed before the player will select "Play Again" ??

    Sorry for my English, I translated from Spanish to google translator

    Thanks a lot
     
  33. AntonioEsse

    AntonioEsse

    Joined:
    Jun 27, 2014
    Posts:
    4
  34. damianbarcena

    damianbarcena

    Joined:
    Jun 12, 2014
    Posts:
    2
  35. Incradiator

    Incradiator

    Joined:
    Mar 29, 2013
    Posts:
    5
    Dude
    this isn't working for me!!!
    I followed the instructions and youtube video...
    I have used admob plugins before, and my previous plugins don't work, and yours either :(
    I read the instructions about 5 or so times, and the video.
     
  36. DuySpy

    DuySpy

    Joined:
    Jun 6, 2014
    Posts:
    2
    Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    C:\Program Files\Java\jdk1.8.0_20\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="D:/adt-bundle-windows-x86-20140702/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    Can't build
     
  37. AtomR

    AtomR

    Joined:
    May 22, 2012
    Posts:
    37
    Hey
    I started working with this plugin yesterday and am really pleased on how fast you can get it to work. It's literally drag, drop, setup your add id and you're good to go.
    Once I am pleased that this works 100% like I want it to I will definatelly be getting the pro version. I haven't changed a single line of code in your plugin but my script use the showBanner and hideBanner methods to hide the banner when the game is playing and show it when the player looses. The only problem I have with it is that it take a while for the add to load so I hardly ever seen a banner. Because the user plays, dies, see his highscore (where the banner should show) and then either quits or presses play again. So the user is never in the highscore part long enough to see a banner. I'm assuming your plugin unloads and reloads the banner everytime we need to hide and show it again, repectivelly. Is there a way to just hide the banner but let it loaded so that at least the last loaded banner shows when you show the banner again.
    I had this behaviour working on an old admob plugin but I had to stop using it coz old AdMob apps can no longer be uploaded to the store.

    I'd appreciate your input. Thank you.
     
  38. arturoza

    arturoza

    Joined:
    Jun 10, 2014
    Posts:
    1
    Hi, I'm struggling with this error, I asked in Unity answers and searched my error everywhere and I can't find a solution, I reinstalled both Java and JDK version 8, then 7 and still the same problem:
    Error building Player: CommandInvokationFailure: Failed to build apk. See the Console for details.
    C:\Program Files (x86)\Java\jdk1.7.0_67\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/Frostbit/Downloads/adt-bundle-windows-x86_64-20140702/adt-bundle-windows-x86_64-20140702/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

    stderr[
    Error: Not a file 'C:\Users\Frostbit\Documents\New Unity Project 8'
    ]
    stdout[

    ]
     
  39. Jogui

    Jogui

    Joined:
    Jul 15, 2014
    Posts:
    3
  40. Jogui

    Jogui

    Joined:
    Jul 15, 2014
    Posts:
    3
    VNTIS, how can we fight against delay when we call a Interstitial to appear?
     
  41. leha92

    leha92

    Joined:
    Sep 6, 2014
    Posts:
    3
    Hi Dear VNTIS!
    Did your example, an error: "NullReferenceException: Object reference not set to an instance of an object"

    Prefab put on the first stage..

    void EndGame ()
    {

    ......

    AdmobVNTIS_Interstitial x = (AdmobVNTIS_Interstitial)GameObject.Find ("AdmobVNTISInterstitialObject").GetComponent ("AdmobVNTIS_Interstitial");
    x.showInterstitial();

    .......

    }
     
  42. CitrusDev

    CitrusDev

    Joined:
    Jul 3, 2012
    Posts:
    115
    Hi VNTIS,
    I tested your assed and used banner align_bottom but it will show up on the top left edge
    did I somethink wrong ? can you please check it.

    Thank you !
     
  43. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    you have to build run on real device. the plugin doesnt work in editor.

    you have to use align_parent_bottom instead
     
  44. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    Version 3.0 released ! No more DELAY!
     
  45. CitrusDev

    CitrusDev

    Joined:
    Jul 3, 2012
    Posts:
    115
    Hi VNTIS,
    thanks for your fast respone. Is it possible to center the banner at the bottom ?
    With align_parent_bottom its aligned bottom left.

    Thank you.
     
  46. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    + center_horizontal
     
  47. LuisDC

    LuisDC

    Joined:
    May 10, 2014
    Posts:
    2
  48. leha92

    leha92

    Joined:
    Sep 6, 2014
    Posts:
    3
    not compiled, an error:

    NullReferenceException: Object reference not set to an instance of an object
    AdmobVNTIS_Interstitial.showInterstitial () (at Assets/AdmobVNTIS/AdmobVNTIS_Interstitial.cs:32)
    GameController.EndGame () (at Assets/_Scripts/GameController.cs:113)
    BirdController.Die () (at Assets/_Scripts/BirdController.cs:69)
    BirdController.OnTriggerEnter2D (UnityEngine.Collider2D col) (at Assets/_Scripts/BirdController.cs:39)"

    I still use the plugin, https://github.com/playgameservices/play-games-plugin-for-unity.
    That the problem of over java and c# probably?
     
  49. VNTIS

    VNTIS

    Joined:
    Mar 24, 2014
    Posts:
    91
    there is something wrong in your code. email me for support taquangtien92@gmail.com (việt nam nhes0
     
  50. leha92

    leha92

    Joined:
    Sep 6, 2014
    Posts:
    3
    Sent you a letter:)
     
unityunity