Quantcast
Viewing all articles
Browse latest Browse all 330

Implementing Admob in signed apk

i am trying to implement admob in my signed apk but it isn't working. I am new to the use of plugins.these are all the changes i made.do i need to do something else?? heres my scripts and manifest: advetisement handler: using UnityEngine; using System.Collections; public class AdvertisementHandler : MonoBehaviour { public enum AdvSize { BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD, SMART_BANNER, DEVICE_WILL_DECIDE }; public enum AdvOrientation { VERTICAL, HORIZONTAL }; public enum Position { NO_GRAVITY = 0, CENTER_HORIZONTAL = 1, LEFT = 3, RIGHT = 5, FILL_HORIZONTAL = 7, CENTER_VERTICAL = 16, CENTER = 17, TOP = 48, BOTTOM = 80, FILL_VERTICAL = 112 }; public enum AnimationInType { SLIDE_IN_LEFT, FADE_IN, NO_ANIMATION }; public enum AnimationOutType { SLIDE_OUT_RIGHT, FADE_OUT, NO_ANIMATION }; public enum Activity { INSTANTIATE, DISABLE, ENABLE, HIDE, SHOW, REPOSITION } public enum LevelOfDebug { NONE, LOW, HIGH, FLOOD } static AndroidJavaClass admobPluginClass; static AndroidJavaClass unityPlayer; static AndroidJavaObject currActivity; /// /// Initializing Plugin with values /// /// Admob App ID /// Advertisement Size /// Advertisement Orientation /// Advertisement First Position /// Advertisement Second Position /// Flag for testing game/app /// Test Device Id /// Animation IN Type /// Animation OUT Type /// Debug Level public static void Instantiate(string pubID, AdvSize advSize, AdvOrientation advOrient, Position position_1, Position position_2, bool isTesting, string testDeviceId, AnimationInType animIn, AnimationOutType animOut, LevelOfDebug levelOfDebug) { Debug.Log("Instantiate Called"); admobPluginClass = new AndroidJavaClass("com.microeyes.admob.AdmobActivity"); unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); currActivity = unityPlayer.GetStatic("currentActivity"); admobPluginClass.CallStatic("AdvHandler", (int)Activity.INSTANTIATE, currActivity, pubID, (int)advSize, (int)advOrient, (int)position_1, (int)position_2, isTesting, testDeviceId, (int)animIn, (int)animOut, (int)levelOfDebug); Debug.Log("Instantiate FINISHED"); } /// /// Enable Advertisements, work if not yet called / after calling DisableAdvs(); /// public static void EnableAds() { Debug.Log("ENABLED Called"); admobPluginClass.CallStatic("AdvHandler", (int)Activity.ENABLE, currActivity, "", -1, -1, -1, -1, false, "", -1, -1, -1); Debug.Log("ENABLED FINISHED"); } advertisement manager: using UnityEngine; using System.Collections; public class AdvertisementManager : MonoBehaviour { [SerializeField] private string m_publisherId = "a14e2fb60918999"; public string PublisherId { get { return m_publisherId; } set { m_publisherId = value; } } /// /// Advertisement Size /// [SerializeField] private AdvertisementHandler.AdvSize m_advSize = AdvertisementHandler.AdvSize.SMART_BANNER; public AdvertisementHandler.AdvSize AdvSize { get { return m_advSize; } set { m_advSize = value; } } /// /// Advertisement Orientation /// [SerializeField] private AdvertisementHandler.AdvOrientation m_orientation = AdvertisementHandler.AdvOrientation.HORIZONTAL; public AdvertisementHandler.AdvOrientation Orientation { get { return m_orientation; } set { m_orientation = value; } } /// /// Advertisement First Position /// [SerializeField] private AdvertisementHandler.Position m_positionOne = AdvertisementHandler.Position.BOTTOM; public AdvertisementHandler.Position PositionOne { get { return m_positionOne; } set { m_positionOne = value; } } /// /// Advertisement Second Position /// [SerializeField] private AdvertisementHandler.Position m_positionTwo = AdvertisementHandler.Position.CENTER_HORIZONTAL; public AdvertisementHandler.Position PositionTwo { get { return m_positionTwo; } set { m_positionTwo = value; } } /// /// Set True, if testing game/app /// [SerializeField] private bool m_isTesting = false; public bool IsTesting { get { return m_isTesting; } set { m_isTesting = value; } } /// /// Test Device Id, if you know /// [SerializeField] private string m_testDeviceId = "4965DFB7E2F16194A15150C45A6927A9"; public string TestDeviceId { get { return m_testDeviceId; } set { m_testDeviceId = value; } } /// /// Animation Type when loading new Advertisement /// [SerializeField] private AdvertisementHandler.AnimationInType m_animationInType = AdvertisementHandler.AnimationInType.SLIDE_IN_LEFT; public AdvertisementHandler.AnimationInType AnimationInType { get { return m_animationInType; } set { m_animationInType = value; } } /// /// Animation Type when unloading current/old Advertisement /// [SerializeField] private AdvertisementHandler.AnimationOutType m_animationOutType = AdvertisementHandler.AnimationOutType.FADE_OUT; public AdvertisementHandler.AnimationOutType AnimationOutType { get { return m_animationOutType; } set { m_animationOutType = value; } } /// /// Level of debug logs /// [SerializeField] private AdvertisementHandler.LevelOfDebug m_levelOfDebug = AdvertisementHandler.LevelOfDebug.LOW; public AdvertisementHandler.LevelOfDebug LevelOfDebug { get { return m_levelOfDebug; } set { m_levelOfDebug = value; } } // Use this for initialization void Start () { Debug.Log("Unity Calling Start"); Debug.Log("Initializing with " + " Pub ID: " + m_publisherId + " Adv Size: " + m_advSize + " Orientation: " + m_orientation + " Position 1: " + m_positionOne + " Position 2: " + m_positionTwo + " IsTesting: " + m_isTesting + " DeviceID: " + m_testDeviceId + " AnimIn: " + m_animationInType + " AnimOut: " + m_animationOutType + " LevelOfDebug: " + m_levelOfDebug ); //Initializing Plugin with values AdvertisementHandler.Instantiate(m_publisherId, m_advSize, m_orientation, m_positionOne, m_positionTwo, m_isTesting, m_testDeviceId, m_animationInType, m_animationOutType, m_levelOfDebug); //Shoot request to enable advertisements AdvertisementHandler.EnableAds(); } } android manifest: Inspector settings of Advertisement handler ![alt text][1] [1]: /storage/temp/25886-untitled.png

Viewing all articles
Browse latest Browse all 330

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>