Reputation: 5428
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
Upvotes: 0
Views: 2436
Reputation: 24988
In my case I was missing adding the ad-mob dependencies to the gradile, once done it worked fine.
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 939
@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).
Upvotes: 1
Reputation: 361
Upvotes: 2