Admob Unity adware project description, Unity develop profitable ideas

Admob Unity Plug-ins Introduction

Admob Unity plug-in provides a way to integrate admob advertising methods Unity3D Game and u3d applications. You can use it for Unity iOS and Android App with the same c # or js code.

Is Unity3d the Admob SDK plug-in that js and c # to make it easier for developers to add Google ads Unity3d game on iOS and Android, support admob interstitial ads and banners

Admob Unity plugin description

Google Mobile Ads SDK is the latest generation in Google mobile advertising products, with improved ad formats and streamlined API, accessible mobile ad networks and advertising solutions. The SDK allows Unity mobile application developers to take maximum advantage of the present machine monetize mobile applications.

The repository contains the source code for Google Mobile Ads Unity plugin. This plug-in gives Unity developers can easily launch Google mobile ads on Android and iOS applications without writing Java or Objective-C code. The plug-in provides a C # interface for requesting Unity project in C # ad scripts.

Unity Admob plug-in function

A plug-supported platforms:

  •  Android, by SDK v18.3.0 (Google Play services platform part)

  •  iOS, by SDK v7.53

  •  Support for all local events

  •  AdRequest positioning method, for example, child positioning, test mode

  •  Android does not need to change the package name

  •  Very simple API

  •  Support for non-personalized ads.

advertisement type:

  •  Slogan (slogans of all types and custom slogans size)

  •  Interstitials (text, pictures, video)

  •  Bonus video

  •  Advanced native ad

Download Admob Unity plugin

Need AdmobPluginRes / GoogleMobileAds.framework and admob_unity_plugin.unitypackage. Please
from Admob Unity3d plug-in project home https://github.com/unity-plugins/Unity-Admob  download these files,
or download all of admob Unity plug-in project https://github.com / unity-plugins / Unity- Admob / archive / master.zip

Installation Admob Unity

  1. Open your project in Unity Editor.

  2. Navigate to Assets-> Import Package-> Custom Package Penalty for .

  3. Select admob_unity_plugin.unitypackage file.

  4. By selecting Import to import  all the files admobdemo.cs (sample script) away. Check to ensure that any conflict with the files.

You can install the file by download folder plug- in files are copied directly to the Unity3d project,

Unity plugin and Documentation Wiki

Quick Start

Edit AndroidManifest.xml and configure Admob APP ID

admob from version 17.0 began requiring this configuration, if not configured, APP will collapse. Add metadata tags and values set in the application admob appid

 <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxxxx~xxxxxxxxxxxx"/>

Sample code

 <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" > <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/> </application>

Editing Info.plist, add appid

<key>GADApplicationIdentifier</key> <string>ca-app-pub-xxxxxxxxxxxxxxxxxxxxxx~xxxxxxxxxxxxxx</string>

Configuration exported Xcode project, build settings -> other linker flags, flag a -ObjC 

1.Init Admob Unity plug-in

AC # Create a script, drag and drop script to the object in the scene, add the following to the script file

using admob; Admob.Instance().initSDK(new AdProperties());//admob id configed in meta,not support in code any more

You can press the following set admob property, you need to set the property to be set

 AdProperties adProperties AdProperties = new (); adProperties.isTesting (true); // true test for ads adProperties.isAppMuted (true); adProperties.isUnderAgeOfConsent (false); adProperties.appVolume (100); adProperties.maxAdContentRating (AdProperties.maxAdContentRating_G); String [] = {keywords "Key1", "key2", "key3"}; adProperties.keyworks (keywords);

2. Add Admob Banner in the Unity App

This is the minimum code necessary to display admob banner.

Admob.Instance().showBannerRelative("your admob banner unit id",AdSize.BANNER, AdPosition.BOTTOM_CENTER, 0);

Or you can create another banner by setting the banner name

Admob.Instance().showBannerAbsolute("ca-app-pub-3940256099942544/6300978111",AdSize.BANNER, 20, 220,"mybanner");

AdPosition class specifies the location to place the banner. AdSize to be displayed, witch size banner

3. Delete Banner

By default, the banner is visible. To hide the banner, please call:

Admob.Instance().removeBanner();

4. How will interstitials integrated into Unity 3d applications?

This is to create interstitials minimum code.

Admob.Instance().loadInterstitial("Your admob interstitial unit id");

And banner ads, interstitials need to be clearly displayed. Stop at the appropriate point of application, check that it is ready before displaying interstitial ads:

if (Admob.Instance().isInterstitialReady()) { Admob.Instance().showInterstitial(); }

5, custom Admob banner ad sizes

In addition to AdSize constant on the outside , you can also create a custom size:

//Create a 250x250 banner. AdSize adSize = new AdSize(250, 250); Admob.Instance().showBannerAbsolute("Your admob banner id",adSize,0,30,"bannerName");

6. How will Admob reward integrate video into Unity3d application?

This video was created admob minimum code.

Admob.Instance().loadRewardedVideo("ca-app-pub-3940256099942544/1712485313");

And interstitial video similar video requires appropriate stopping point in your application clearly shows, check the video before displaying the video if ready:

if (Admob.Instance().isRewardedVideoReady()) { Admob.Instance().showRewardedVideo(); }

7, advanced advertising in Admob native iOS and Android App in

This is the minimum code necessary to display admob banner. This is done by native Admob ads Advanced Edition (unified) implemented

Admob.Instance().showNativeBannerRelative("Your native banner id",new AdSize(360,100), AdPosition.BOTTOM_CENTER);

8. Campaign

Both banner and interstitial included you can register the same campaign. Here, we'll show you set up your event on interstitial ads, and display interstitials at load successfully:

Admob.Instance().interstitialEventHandler += onInterstitialEvent; void onInterstitialEvent(string eventName, string msg) { Debug.Log("handler onAdmobEvent---" + eventName + " " + msg); if (eventName == AdmobEvent.onAdLoaded) { Admob.Instance().showInterstitial(); } }

You only need to register the events you care about.

Unity Admob demonstrate the use of

  1. The AdmobUnityPlugin.unitypackage into your Unity project

  2. The Admobdemo.cs copied from AdmobPluginRes to your consolidated project / asset dic

  3. The main camera is attached to admobdemo.cs

  4. In admobdemo.cs edit admob ID

  5. Build and run on your device

  6. Add -ObjC flag other xcode linker flag 7 add meta key application in Xcode Info.plist

    GADApplicationIdentifier ca-app-pub-xxxxxxxxxxxxxxxxxx〜xxxxxxxxxx

important hint

  1. If you AndroidManifest.xml is not configured, the application will crash

  2. If you do not add -ObjC mark, the application crashes

  3. If you do not add GADApplicationIdentifier in the Info.plist, the application crashes

  4. The admob attached to an object in the scene before calling admob fun initialization admob

Screenshots


Guess you like

Origin blog.51cto.com/14757709/2479388