how to add real admob ads in to my unity game? - unity3d

i want to implement real admob ads in my unity game, i have found banner ad code from google and i replaced test unit id with my real admob app unit id. now problem is that when banner ad show a test ad will be app appeared on to top side of banner ad pls help why show show test ad while i implement real add unitID here is banner ad code.
using System;
using UnityEngine;
using GoogleMobileAds.Api;
public class realsimpleAd : MonoBehaviour
{
private BannerView bannerView;
public void Start()
{
this.RequestBanner();
}
private void RequestBanner()
{
string adUnitId = "ca-app-pub-1154915214031679/1860375924";
this.bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
// Called when an ad request has successfully loaded.
this.bannerView.OnAdLoaded += this.HandleOnAdLoaded;
// Called when an ad request failed to load.
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
this.bannerView.LoadAd(request);
}
public void HandleOnAdLoaded(object sender, EventArgs args)
{
MonoBehaviour.print("HandleAdLoaded event received");
}
}
pls help me thanks in advance

Admob will always show test ads in the Unity editor and in applications with few views and recently published.
To experience real ads, you will need to post your app on a store and wait until it downloads enough to show the ads.
As soon as it is published, no ads will appear, because it has not received enough views.

Related

Unity - Admob hide banner doesn't work on real id

First, my problem is not this:
Unity - Admob hide banner doesn't work
I'm using Admob in Unity 2018.4.2f1
My problem is, everything work great on test id, but in the real id, the banner won't get destroyed or at least be hidden.
This is my code:
public void HideBanner()
{
lock (_syncRoot)
{
if (bannerView != null)
{
bannerView.Hide();
bannerView.Destroy();
this.BannerAdState = AdState.None;
}
}
}
My device can't test with the real AdmobID so I don't know what happened, but my client always feedbacks that the banner overdrawing the game's buttons in the Game Result Screen.
But I called AdsManager.Instance.HideBanner() when started Game Result Screen, and it work fine on test id. I don't know why it doesn't hide in the real id.
Thank you all.

Manage Game Music At Fullscreen Ad Display Time

I have used AppLovin Ad Network to display fullscreen ads within the game.
So I want to turn off game music when fullscreen ad displayed and again turn on game music when fullscreen ad closed by the game player.
I have followed this guideline:
Unity3d Integration
Here we have different listeners available:
Ad Listeners in Unity
I was getting the problem in iOS only in Android automatically game background music gets paused and played again when I closed the fullscreen ad.
Code that I have tested up to now:
public void ShowAppLovinInsterstitial()
{
// Showing utilizing PreloadInterstitial and HasPreloadedInterstitial
if (AppLovin.HasPreloadedInterstitial())
{
// An ad is currently available, so show the interstitial.
AppLovin.ShowInterstitial();
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(false);
#endif
}
else
{
// No ad is available. Perform failover logic...
AppLovin.PreloadInterstitial();
}
}
void onAppLovinEventReceived(string ev)
{
if (ev.Contains("HIDDENINTER"))
{
// Ad ad was closed. Resume the game.
// If you're using PreloadInterstitial/HasPreloadedInterstitial, make a preload call here.
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(true);
#endif
AppLovin.PreloadInterstitial();
}
else if (ev.Contains("CLOSEDFULLSCREEN"))
{
#if UNITY_IOS
SoundManager.Instance.EnableGameMusic(true);
#endif
}
}
At present, game music gets paused after fullscreen ad displayed. On fullscreen ad, it was not again started.
Please give me some suggestion for the gameplay music turn on and off during fullscreen ads display.

How to implement AppLovin Reward Video in unity?

I'm trying to add reward video from AppLovin to my application. Interstitial is work perfectly. But Reward video return "LOADREWARDEDFAILED".
Here is the part where I initialize
AppLovin.SetSdkKey(SDKKey);
AppLovin.InitializeSdk();
AppLovin.PreloadInterstitial();
AppLovin.LoadRewardedInterstitial();
AppLovin.SetUnityAdListener("ApplovinListener");
// AppLovin.SetTestAdsEnabled("true");
Here is the part where should be show
if (AppLovin.IsIncentInterstitialReady())
AppLovin.ShowRewardedInterstitial();
else
AppLovin.LoadRewardedInterstitial();
Message from xcode:
LOADREWARDEDFAILED
ApplovinListener:onAppLovinEventReceived(String)

Failed to pass eligibility in the Google Daydream Appstore for my hybrid Daydream + Cardboard app using Unity VR

I am getting the issue: The app does not use the Daydream controller properly
The app allows users to use head gaze to position the cursor and interact with menu UI's "Play" button.
Here is my class that sets the GvrPointerInputModule.Pointer to either use the GVRLaserPointer (for daydream) or the GvrReticlePointer (for cardboard):
public class InputModuleSelector : MonoBehaviour {
bool DaydreamControllerConntected = false;
public GvrBasePointer DayDreamController;
public GvrBasePointer CardboardController;
private void Start() {
refreshControllers();
}
public static bool IsDayDreamMode() {
return VRSettings.loadedDeviceName != "cardboard";
}
private void refreshControllers() {
DaydreamControllerConntected = IsDayDreamMode();
DayDreamController.gameObject.SetActive(DaydreamControllerConntected);
CardboardController.gameObject.SetActive(!DaydreamControllerConntected);
GvrPointerInputModule.Pointer = DaydreamControllerConntected ? DayDreamController : CardboardController;
}
}
If we use the daydream, we will use the laser, otherwise we will use the reticle.
How can I get my app to pass? Are we allowed to submit an app that can be used for both daydream and cardboard? Let me know if you need more information.
I am not sure if I should include a link... but my app is active on the playstore: https://play.google.com/store/apps/details?id=com.fungamefuntime.warehouse
It appears as though you let the cursor be controlled with head gaze. Head gaze is allowed as a controller substitute in all elements of gameplay, except when menus appear.
I was able to figure and correct the issue with the help from Google Support. The main Camera rotates with the player's gaze direction. This means that the GvrControllerPointer depends on the main camera. This violated the requirements because you moved the laser when you also moved your head. Hierarchy View:
Player
Main Camera
GvrReticlePointer
GvrControllerPointer
When I switched to this structure, the problem was solved. The GvrControllerPointer is now independent of the Main Camera and the player's gaze.
Player
GvrControllerPointer
Main Camera
GvrReticlePointer

Why wont the onroomconnected switch scenes in unity when its called by google play services

So Ive been following this tutorial for implementing real time multiplayer with google play services for unity Tutorial. However I got stuck on part two whenever I test it between two devices I happen to use android. It wont move to the game scene It just hangs out in the main menu. I have not used adb but I have been able to invite people.
public void OnRoomConnected(bool success)
{
if (success)
{
ShowMpStatus("We are connected");
lobbyListener = null;
SceneManager.LoadScene(1);
} else
{
ShowMpStatus("Sorry not connected");
}
Try using this to load and send you to the next scene.
SceneManager.LoadScene ("OtherSceneName", LoadSceneMode.Single);
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
https://docs.unity3d.com/ScriptReference/SceneManagement.LoadSceneMode.html