0

Prime31 plugin is not for free, I'm too poor to buy it.

https://github.com/guillermocalvo/admob-unity-plugin plugin is good for admob banner, but doesn't support InterstitialAd.

https://github.com/googleads/googleads-mobile-plugins is google's official plugin, but crashes on Android:

void initAd()
    {
        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd("ca-app-pub-0243484158988577/4626472594");
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }


? 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2187) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.ActivityThread.access$800(ActivityThread.java:138) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.os.Handler.dispatchMessage(Handler.java:102) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.os.Looper.loop(Looper.java:136) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.ActivityThread.main(ActivityThread.java:5034) 08-23 17:22:52.264: E/AndroidRuntime(17984): at java.lang.reflect.Method.invokeNative(Native Method) 08-23 17:22:52.264: E/AndroidRuntime(17984): at java.lang.reflect.Method.invoke(Method.java:515) 08-23 17:22:52.264: E/AndroidRuntime(17984): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:805) 08-23 17:22:52.264: E/AndroidRuntime(17984): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:621) 08-23 17:22:52.264: E/AndroidRuntime(17984): at dalvik.system.NativeStart.main(Native Method) 08-23 17:22:52.264: E/AndroidRuntime(17984): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.admobtest/com.unity3d.player.UnityPlayerNativeActivity}; have you declared this activity in your AndroidManifest.xml? 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Activity.startActivityForResult(Activity.java:3435) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Activity.startActivityForResult(Activity.java:3396) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Activity.startActivity(Activity.java:3638) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Activity.startActivity(Activity.java:3606) 08-23 17:22:52.264: E/AndroidRuntime(17984): at com.unity3d.player.UnityPlayerProxyActivity.onCreate(Unknown Source) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Activity.performCreate(Activity.java:5242) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 08-23 17:22:52.264: E/AndroidRuntime(17984): at com.lbe.security.service.core.client.b.x.callActivityOnCreate(Unknown Source) 08-23 17:22:52.264: E/AndroidRuntime(17984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2151) 08-23 17:22:52.264: E/AndroidRuntime(17984): ... 11 more

How can I use Admob InterstitialAd in Unity3d?

Gank
  • 4,507
  • 4
  • 49
  • 45
  • Why not use the Offical AdMob plugin from Google. Get it from here- https://github.com/googleads/googleads-mobile-plugins/tree/master/unity. It works perfectly for me. – Kunalxigxag Sep 15 '14 at 05:10

2 Answers2

0

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.admobtest/com.unity3d.player.UnityPlayerNativeActivity}; have you declared this activity in your AndroidManifest.xml?

This is key. Your android manifest must contain the activity : com.google.android.gms.ads.AdActivity

Check this : https://developers.google.com/mobile-ads-sdk/docs/

Josh
  • 210
  • 1
  • 7
  • I've added `com.google.android.gms.ads.AdActivity` and declared that activity, but still the same – Gank Aug 27 '14 at 07:08
0

have you tried https://github.com/unity-plugins/Unity-Admob. I have success with this one. the code show InterstitialAd

void Start () {
        Admob.Instance().interstitialEventHandler += onInterstitialEvent;
    }

   Admob ad = Admob.Instance();
    ad.initAdmob("ca-app-pub-27960454450664210/xxxxxxxxx", "ca-app-pub-279343530664210/xxxxxxxxxxx");

void onInterstitialEvent(string eventName, string msg)
    {
        Debug.Log("handler onAdmobEvent---" + eventName + "   " + msg);
        if (eventName == AdmobEvent.onAdLoaded)
        {
            Admob.Instance().showInterstitial();
        }
    }
Mi-Creativity
  • 9,554
  • 10
  • 38
  • 47
jobs
  • 36
  • 1