I tried to implement interstitials from Admob on Android, but the ad doesn’t show up when
I call it with a 5s delay after event begin play.
Banner ads work without problems on the same engine 4.7 source from github and
the GameActivity file runs through packaging without errors.
My GameActivity.java file is attached. All my changes there are marked with //peep comment.
What I did:
- Added a new node called ShowIntAd, so I could call the interstitial from blueprint as well
- Implementation similar to banner, but with provider pointing to ShowIntAd
- Added ShowIntAd() as a new virtual function in the interface
- ShowIntAd function similar to the banner but with AndroidThunkCpp_ShowIntAd without bool
- Defined AndroidThunkJava_ShowIntAd as a new FindMethod
- added jmethodID FJavaWrapper::AndroidThunkJava_ShowIntAd;
- made function void AndroidThunkCpp_ShowIntAd(const FString& AdUnitID)
- import com.google.android.gms.ads.InterstitialAd;
- private InterstitialAd interstitial;
- Implemented method "void AndroidThunkJava_ShowIntAd(String AdMobAdUnitID)
- Added interstitial.show and _activity.interstitial.loadAd(adRequest) to method “private void updateAdVisibility”
Maybe I have to include something in some build.cs somewhere in the engine source? Or GameActivit.java has to be changed in another way?
Is this question to specific like stackoverflow?
I had a look (or two at it again and was finally able to display interstitial ads with the gameactivity.java file attached.
It preloads an ad in the oncreate function and every time after the ad is closed. This way I don’t get the delay from requesting to showing the ad. The ad itself displays everytime its called from custom blueprint node ShowIntAd.
I had some app crash on start up with error “In the JNI_OnLoad function” when I tried to add another FindMethod in AndroidJNI source files for my custom BP node. So so far I have to input the AdUnitId manually in the OnCreate function. Maybe some better solution comes up.link text
Hi have you tried this for iOS? If yes I would love to get more information
No unfortunately not. But I guess you can follow along the same path where the ShowAd function goes in to the iOS module.
Hi spaceharry, how do you recompile the engine changes so that the new blueprint function appears ?.. Do I need to download the engine source from github ? Thanks
See this video ADMOB Unreal Engine 4:
Simple method Working Interstial
We’ve made a plugin that adds AdMob interstitial support for Android platform in UE4 blueprints for UE4 starting from 4.10.
You can find it here: GitHub - AnnaIvanova/UE4AdBoxPlugin: Plugin that adds AdMob interstitial support for Android platform in UE4 blueprints
Hope it will help
We can help you. Our plugin Universal Mobile Ads for iOS & Android is exactly what you need: Universal Mobile Ads for iOS & Android - Marketplace - Unreal Engine Forums It includes support for 15 ad networks (more coming soon) and Banners, Interstitials, Rewarded Videos. Plugin was released 2 years ago and was tested in many ways during this time. It’s stable, receives update every 1-2 months ,and we provide premium support.
If you have any questions, feel free to ask!