- Home /
Load Leadbolt ad before exiting from Game Unity3d
Hello everyone ,
I have integrated Unity Android SDK ffor LeadBolt. My ad is loading/working on start.
But i want to load ad before killing my game.
But idont finding the way thet the ad is loaded or not. so that i can kill my game.
script i have written is here:
using UnityEngine; using System.Collections;
public class LoadAd : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Escape))
{
Ad();
}
}
IEnumerator Ad()
{
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
using(AndroidJavaObject ad = new AndroidJavaObject("com.unity.wrapper.LeadBoltUnity", jo))
{
ad.Call("loadAd","837124071");
yield return new WaitForSeconds (5.0f);
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
}
}
Thanks In advance for your support and help..
Use Application.Quit() to exit the app. It doesn't work on web build, and is discouraged on ios.
sir you are right,.. but i want to quit from the game after the ad is being loaded. SO i need some method to identify the ad is loaded.. i want to know leadbolt is having such kind of way to check?
Your answer
Follow this Question
Related Questions
Mobile Ads Frameworks that support unity 0 Answers
Unity ads problem for mobile 0 Answers
admob related question 2 Answers
AdMob RewardBasedVideoAd, App crash after reward video closed (Android) 5 Answers
Unity3d banner ads 1 Answer