Rellac
Rellac

Reputation: 63

AdMob wont repond to Clicks - Unity

I have recently finished an android game and I am struggling to enable my ads. They show just fine whenever I want them to, but I can't seem to click them at all. I think the issue may be within my manifest file, but through all my googling I found no solutions that seemed to work for me.

Here is my AndroidManifest.xml:

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    android:installLocation="preferExternal"
    android:versionCode="1"
    android:versionName="1.0">
    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true"/>

    <application
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:debuggable="true">
        <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
        <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
                  android:label="@string/app_name"
                  android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:label="@string/app_name"
                  android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
        </activity>
        <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
                  android:label="@string/app_name"
                  android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
            <meta-data android:name="android.app.lib_name" android:value="unity" />
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
        </activity>
        <activity android:name="com.unity3d.player.VideoPlayer"
                  android:label="@string/app_name"
                  android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
        </activity>
        <activity android:name="com.google.ads.AdActivity"
                  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    </application>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>

This is located within Assets > Plugins > Android, the files I have located within here are as such:

There are no objects in front of the ad. My game consists of an empty screen with few objects falling occasionally. These objects can (read: can't) be seen behind the Ad.

This line is one that I found from Unity Answers and may or may not be used properly here (Line 18):

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

I used This source (Android version) to create the ads. They generate just fine using the cs scripts, only touching them takes me to no source.

Within my Ad Manager file, I have input my AdMob code. However, I'm unsure if I need all of the information that I have put here. I am using the format:

ca-app-pub-XXXXXXXXXXXXXXXXX/XXXXXXXXXX

Each X representing a number (can't link that thing) - is this the correct format? I am unsure or if I should be using the "ca-app-pub" section, or if I need only the numbers from one side of the /.

Any help would be greatly appreciated, thanks. Any more required information can be given, but I believe this is all that is required.

AdvertisementManager.cs

AdvertisementHandler.cs

Upvotes: 0

Views: 320

Answers (1)

Frank Nguyen
Frank Nguyen

Reputation: 6643

Try to add this line

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

In to UnityPlayerActivity:

<activity android:name="com.unity3d.player.UnityPlayerActivity"
          android:label="@string/app_name"
          android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />

</activity>

Upvotes: 1

Related Questions