0

I am trying to add my first advertisement to my android app. I followed a tutorial, and added the following code to my xml file

 <com.google.android.gms.ads.AdView
                android:id="@+id/adView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                ads:adSize="BANNER"
                ads:adUnitId="@string/banner_ad_unit_id"
                >
            </com.google.android.gms.ads.AdView>

It displays the ad in my emulator as well as in my real device . In my emulator, the ads like 'Install This App' are displaying and download symbol also visible. In my emulator , the ad is visible and refreshing clearly but click is not at all enabled. No response with a click.

I googled stack overflow questions but no apt answers were there. Any help will be appreciated.

ps: I didnt try clicking in my emulator due to the admob ban issues

codeX
  • 4,842
  • 2
  • 31
  • 36

4 Answers4

2
  1. Check Your Layout Arrangements. May be Some other Layouts overlaps the ad container.So when you click it clicks the overlapped layout components.
  2. Make sure the ad is active/ enabled in your admob account. As I remember it shows colour green when active.
  3. Try creating another ad unit and add the ad again.
Kanishka
  • 267
  • 4
  • 21
1

@arunprakashpj, Your AdView seems ok, but you need to check the parent layout to see if everything is ok.

You need to be sure this isn`t problem of the Ad itself. To prevent the admob ban issues you can set the emulator (or any device) as a Test Device, so you'll get Test banners that you may click without fear.

To see how to implement test banners, check this link (they have an example there): https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start#enjoy_a_freshly_loaded_ad

Please, let us know the click result when you're using the test banners. (If click works in test ads, it means that the problem probably will be the Ad itself and not your code).

Thiago Elias
  • 939
  • 1
  • 6
  • 21
0

The way I solved such problem:

In Unity3D 4.XX in your current Assets folder open

Plugins > Android > AndroidManifest.xml

In the AndroidManifest.xml file under the

application > activity

you can find unityplayer.ForwardNativeEventsToDalvik property, which by default is false, like this:

<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />

so change it to true,

<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />

afterthat Save it and re-build.

BSeitkazin
  • 2,889
  • 25
  • 40
0

In my case I was missing adding the ad-mob dependencies to the gradile, once done it worked fine.

Hasan A Yousef
  • 22,789
  • 24
  • 132
  • 203