googleads-mobile-unity: Instantly Crashs on "Initialization" for "InterstitialAd" & "RewardVideoBasedAd"
Thank you so much for taking your valuable time to take a look into the following issue.
I have attached the “unityPackage” by which you can test it on your editor & device. Also, the following script shows how it was ported to physical device for testing.
UnityPakage : https://drive.google.com/open?id=0B-YWb5BzJ1ZeSkFyN2VKTGtqY0E “Video” showing crash report : https://drive.google.com/open?id=0B-YWb5BzJ1ZeVWRfYlpjdG4zd2c DeviceID : https://drive.google.com/open?id=0B-YWb5BzJ1Zed29yT1NJcnl4cEU
Additional Information:
Unity Version ; 2017.1.0f3
Admob SDK : Google Mobile Ads Unity Plugin - v3.8.0
Android Device : Asus Zenfone - 5
OS Version : 5.0 (Lolipop)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class TestScript : MonoBehaviour {
InterstitialAd interstitial;
private string debugMessege;
// Use this for initialization
void Start () {
}
private void mInitializeInterstetialAd(){
debugMessege = "Before Initialization";
#if UNITY_ANDROID
// InterstitialAd testID from admob
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Initialize an InterstitialAd.
interstitial = new InterstitialAd(adUnitId);
debugMessege += "\nInterstitialAd Initialized";
// Create an empty ad request.
AdRequest request = new AdRequest.Builder()
.AddTestDevice(AdRequest.TestDeviceSimulator)
.AddTestDevice("A1803A2F089A97C5")
.AddTestDevice("357996068713245")
.Build();
debugMessege += "\nAfter AdRequest";
// Load the interstitial with the request.
interstitial.LoadAd(request);
debugMessege += "\nLoad InterstetialAd";
}
void OnGUI(){
float mHeight = Screen.height / 10.0f;
if (GUI.Button (new Rect(0.0f, 0.0f, Screen.width, mHeight),"Initialize")) {
mInitializeInterstetialAd ();
}
if (GUI.Button (new Rect(0.0f, mHeight, Screen.width, mHeight),"ShowAd")) {
if(interstitial.IsLoaded())
interstitial.Show ();
}
GUI.Label (new Rect (0.0f, mHeight * 2, Screen.width, mHeight * 2), debugMessege);
}
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (9 by maintainers)
@dariuszpietrala glad your issue has been resolved. With the next release of the GMA Android SDK, this workaround won’t be required.