1

I'm wondering to add google's admob (rewarded video) to my project. But it's not displaying! only banner ad displayed, but rewarded and interstital ads are not displaying

I fully know that my code works! because i created a new project, with only this ad plugin and with my code, and everything works great! But not in my project. I setted correct appId, correct test unit id, test device ID. I followed this https://developers.google.com/admob/unity/start

I initialized the mobileads with my app id for android with MobileAds.Initialize(appId);

//Then in other scene i create a request for an ad

private void RequestRewardBasedVideo()
{
    if UNITY_ANDROID
        string adUnitId = "ca-app-pub-3940256099942544/5224354917";
    elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-3940256099942544/1712485313";
    else
        string adUnitId = "unexpected_platform";
    endif

    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder()
        .AddTestDevice("3E7435172662C5C5A758D31EF5154A01")
        .Build();
    // Load the rewarded video ad with the request.
    this.rewardBasedVideo.LoadAd(request, adUnitId);
}

//Then i show the Video

public void showVideo()
{
    if (rewardBasedVideo.IsLoaded())
    {
        Debug.LogError("Showing the video");
        rewardBasedVideo.Show();
    }
    else
    {
        Debug.Log("The ad is not loaded yet");
    }
}

I suppose, that it's having problems with android Manifest, because activity of ad is not showing. I made sure AndroidManifest file to have
com.google.ads.AdActivity, after generating the apk. Now i have no idea what to try. I have a firebase in my project, maybe it's creating issues.

It gives, when i want to show the ad, in logcat:

02-06 15:15:02.186 4653 17833 I ActivityManager: START u0 {act=null typ=null flg=0x0 cmp=ComponentInfo{com.thousand.myApp/com.google.android.gms.ads.AdActivity}} from uid 10225 02-06 15:15:02.303 4653 15852 D ActivityManager: isScaleDownAnimationEnabled() : false 02-06 15:15:02.387 4653 6506 D ActivityManager: isScaleDownAnimationEnabled() : false 02-06 15:15:02.411 4653 6506 D ActivityManager: post active user change for 0 fullscreen true isHomeActivity() false

Данияр
  • 91
  • 1
  • 10

1 Answers1

0

The problem was connected with firebase! but I don't know what exactly caused it. Firstly i removed the cloud messaging in AndroidManifest, then the rewarded video started to work. After that i removed all firebase cloud messaging files, then reinstalled the firebase cloud messaging package. Then there were no problems

Данияр
  • 91
  • 1
  • 10