Hi everyone , i have a shit problem in my game … i have tested my game on my mobile before adding admob and it worked fine but when i added admob with script and trying to test on my phone , the app crashes and didn’t open …
1- i have enabled Google AdMob from android settings like the image .
2- i have added the same app id in google admob and manifest like in image .
3- i have created empty object and attached the script into it .
4- the ads works perfectly in my Console in unity like in the image .
Please everyone i need your help … i have tried many ways but i still have the problem … i need your help guys
and thanks for everyone .
here is my code…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class ADMOBADS : MonoBehaviour
{
private BannerView bannerView;
void Start()
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(initStatus => { });
this.RequestBanner();
}
private void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/6300978111";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
this.bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
this.bannerView.LoadAd(request);
}
}