Specific steps for adding ad systems to Android applications developed by Unity3d
And then get the starting source.
http://tank2308635.iteye.com/blog/1126047
Find the origin of the AdMob plugin from this article
AdMob plugin that works in Unity 3.2
First tried the method of the compatriots, tossing about a day, not the result, always error, finally no way, think, from the root to solve it, so began to see the foreigner's post, to tell the truth English technology paste than the novel what good understanding. And the discussion in the official forum is really good, many people have their own experience and steps to share to everyone. With the help of translation tools, generally understand how to do, but the key to re-hit jar package is not very clear, although a few people shared the steps, but is based on Mac system, very win system and some differences, so, and from the aid document to find the description of plugins. The following is the translation of the Holy Scriptures
Http://game.ceeger.com/Manual/Plugins.html#AndroidPlugins
Finally understand the plugin is a what's going on. And according to the forum in front of the reply, even the Mongolian guess finally fix, which also and the Forum of a foreigner through a few times letter, don't say, our non-native English people still understand.
Talk less, the following is my step.
With AdMob, you must change the package name of the final released game to the package name in Unitypackage, but the package name in Unitypackage can be modified. In addition Unitypackage unity in the use of only androidmanifest.xml,res,libs,bin is necessary, the above article also said.
1, download the above Unitypackage and import unity, in fact, it is extracted;
2, with Eclipse New project, named Unityad, this does not matter, the need to pay attention to the package name, must be and your final release of the game consistent. For the convenience of the following the name of the activity and unitypackage in the same, after decompression plugins\android\src\org\example\admobtest.
3, right-click on the project name, select Properties, import two packages, one is the above Unitypackage directory under the Android/libs Admob-sdk-android.jar, you can download the latest package from the AdMob website, the other is unity\ Editor\data\playbackengines\androidplayer\bin\classes.jar
4. Use the Admobtestactivity.java and androidmanifest.xml in unitypackage to overwrite the corresponding files in Android project, replace the corresponding folder of Android project with the Res folder in Unitypackage, preferably delete the original Of the cuff, covering did not try, in order to insure it.
5. Open Admobtestactivity.java and find "admanager.settestdevices (new string[] {" ABCDEF1234578901234567890123456 "}); Switch
| 12 |
finalString androidId = Secure.getString(getContentResolver(), Secure.ANDROID_ID); //get Android Device Id. AdManager.setTestDevices( newString[] { androidId } ); //Add Android ID to Admob. |
Open Androidmanifest.xml, find "<meta-data android:value=" Your_id_here "android:name=" admob_publisher_id "/>", Replace the your_id_here with your own admobid.
6, running, run as Android application.
7, run CMD, the use of CD command to go to the project Bin directory, but my Win7 under the command unexpectedly can not turn over, can only go to the C packing directory, so only the project directory under the Bin folder of the COM folder copy to the C drive, the COM folder into a jar package. The specific commands are as follows
Copy this jar package to the Assets\plugins\android\bin in the Unity Engineering directory
8. Copy the XML files from the Android project into the assets\plugins\android\ in the Unity project directory. If the new Android project you just imported is a jar package downloaded from AdMob, then copy it to Assets\plugins\android\libs and replace it with the original.
The Ultimate Unity Project Plugins folder is only androidmanifest.xml,res\,libs\,bin\
9, and your project together to run OK, simulator and real machine test all pass, the best real machine, the effect is good.
Transferred from: http://www.cnblogs.com/zhiweifire/archive/2011/10/18/2216892.html