Basic Unity3D plugin for AdMob (Google Play Services).
Just import the file googleadmob.unitypackage in your Unity project.
Open your app's manifest file and add the following tag as a child of the <application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />Add the following Activity:
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>Add following permissions
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>This is specified on the Android documentation as well.
And finally you'll also need to add or modify the metadata information for the UnityPlayerNativeActivity
otherwise the ads won't be clickable.
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />The Unity package provides an example script on how to use this plugin.
- Make sure that Android SDK is correctly installed and that the
Google Play servicespackage is downloaded as specified on the Android documentation. - Import the library project
google-play-services_libfrom<ANDROID_SDK_DIR>/extras/google/google_play_services/libprojectto Eclipse. - Copy
classes.jarfrom<UNITY_DIR>/Editor/Data/PlaybackEngines/androidplayer/binto<PLUGIN_DIR>/java/libs. - Include the
google-play-services_libas an Android library to the plugin project.
The project should now build on Eclipse.
After succesfully building the Android plugin you can copy the library jar file from the
bin folder to your Unity project at Assets/Plugins/Android.