Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 14    Views: 1263

KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
01/15/14 04:57 AM (11 years ago)

Solved: About Adding Admob Interstitial Ads to Android BT v3

Hi Everyone, Can someone please show me how to add Admob Interstitial Ads to an Android BT v3 app? I am having difficulties in adding it in the new core 3.0 since its having fragments instead of activities. I already added banner ads. Thanks!
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/15/14 05:21 AM (11 years ago)
I have just added admob banner ads to an app, which pretty much consisted of adding lines of xml in the right places. (I used the guide here http://www.buzztouch.com/forum/thread.php?fid=64DE8F7C56FC178B149FAFB&tid=64DE8F7C56FC178B149FAFB ). I had a look at the interstitial adverts as well, but it definitely requires a different approach - it isn't done in xml. I'm not a developer and I didn't know where to add the code into BT from the examples google provide. Alan
 
KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
like
01/15/14 05:27 AM (11 years ago)
Yes I am having difficulties in adding Admob Interstitial Ads in the new core 3.0 since its having fragments instead of activities. I already know how to add banner ads.
 
KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
like
02/01/14 04:05 AM (11 years ago)
I will release a guide on how to add Admob Interstitial ads soon, already got it working in some of my BT android apps
 
KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
like
02/01/14 04:58 AM (11 years ago)
Solved: Here is How to Add Admob Interstitial Ads to an Android BT v3 App since its having fragments instead of activities: https://www.buzztouch.com/forum/thread.php?tid=64DE8F7C56FC178B149FAFB
 
Prince apps
Aspiring developer
Profile
Posts: 121
Reg: Nov 23, 2012
Mumbai
1,210
like
08/02/14 01:35 AM (11 years ago)
your thread link is dead buddy. please suggest how to How to Add Admob Interstitial Ads and banner ads to an Android BT v3 app. please send me tutorial on my mail [email protected]
 
KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
like
08/02/14 01:41 PM (11 years ago)
My guide links are not dead as you suppose, Lol. My marriage is by the corner: reason why I was not always here, cheers!
 
KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
like
08/29/14 09:26 AM (11 years ago)
I think the problem is from buzztouch, that link was working before...
 
Alessandro Polidor...
Lost but trying
Profile
Posts: 13
Reg: Aug 28, 2014
Roma
2,980
like
11/24/14 06:49 AM (10 years ago)
Hi Everyone, link is broken, Invalid request (2) is the error. Is possible to post here how add Admob Interstitial Ads to an Android BT v3 App? Thanks, Alessandro
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/22/15 11:38 AM (10 years ago)
Has anyone had any success with admob interstitials yet? I just tried again and I am not much closer. @KennedyE, the link you posted to the buzztouch post is broken, do you have a copy you could post again? Cheers, Alan
 
KennedyE
Android Fan
Profile
Posts: 373
Reg: Dec 07, 2013
PH, Nigeria
3,730
like
01/22/15 01:05 PM (10 years ago)
How to Add Admob Interstitial Ads to an Android BT App: 1. Add this code to your AndroidManifest before closing application: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 2. In your java add this code among other imports: import com.google.android.gms.ads.*; 3. In your java add this code in your activity class (the main class that extends Activity): private InterstitialAd interstitial; 4. Still in your java add this code to somewhere in your //onCreateView... : interstitial = new InterstitialAd(getActivity()); interstitial.setAdUnitId("Your_Google_Admob_Ad_ID"); AdRequest adRequest = new AdRequest.Builder().build(); interstitial.loadAd(adRequest); and it should look like this using smug location plugin for instance: View thisScreensView = inflater.inflate(R.layout.sw_smugmsgloc, container, false); screenView = thisScreensView; interstitial = new InterstitialAd(getActivity()); interstitial.setAdUnitId("Your_Google_Admob_Ad_ID"); AdRequest adRequest = new AdRequest.Builder().build(); interstitial.loadAd(adRequest); 5. Lastly, in your java add this code to your //onStart, or //onResume, or //onDestroy or just anywhere you want to load the Ads: if (interstitial.isLoaded()) { interstitial.show(); } and it should look like this: //onDestroy @Override public void onDestroy() { ((BT_activity_host)getActivity()).stopListeningForLocationUpdate(); super.onDestroy(); BT_debugger.showIt(fragmentName + ":onDestroy"); if (interstitial.isLoaded()) { interstitial.show(); } } Hope it still works, its been a long time now since I use BT!
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/22/15 03:33 PM (10 years ago)
Cheers, I will give it a go. Thanks, Alan
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/23/15 10:14 AM (10 years ago)
It worked, many many thanks @KennedyE. I installed your code and there were no errors, but I simply didn't see any interstitials for a long time. I believe I had two problems. To be sure I was receiving any interstitials I set up test mode. I also put some logcat logging in to make sure the ad request was being called. The code below is basically your step 4, with that little bit added for test purposes. Your step 4 is all you need for live ads. // lines below added 23 Jan 2015 to support interstitial admob ads // This bit calls the interstitial for displaying later BT_debugger.showIt(fragmentName + ": calling load interstitial: "); // put something in the log interstitial = new InterstitialAd(getActivity()); // Create Interstital (Admob) interstitial.setAdUnitId("ca-app-pub-9999999999999/7777777777"); // Use your dedicated Admob ID AdRequest adRequest = new AdRequest.Builder().build(); adRequest = new AdRequest.Builder() // set up for the test device ID shown in logcat, comment out for live use .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("7B5C4749B88194755F01E0143657EA8D")// any value seems to work .build(); interstitial.loadAd(adRequest); // request the ad, to be displayed later // lines above added ajm 23 Jan 2015 to load interstitial admob ads The other problem I had was where to place the code to display the interstitial (step 5). Once I was getting the test ads reliably, that was a lot easier. Cheers, Alan
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
12/15/15 04:19 AM (9 years ago)
Hello guys, I've been trying to create interstitial admob on exit of my app. Not being a coder, your thread has been very useful, thank you. I work with Android Studio. Following your explanations and the google developer page on admob (https://developers.google.com/admob/android/existing-app?hl=fr), I'm trying to go somewhere, but I still have questions : Following your steps KennedyE, 1. Should I copy your lines just as such in the Manifest, or am I supposed to adjust part of it for my app ? 2. When you say "In you java", do you mean in BT_activity_start ? 3. I copied that line in the BT_activity_start just after public class BT_activity_start extends Activity { public String activityName = "BT_activity_start"; Is that correct ? 4. I found onCreateView in the BT fragment. Is it the right place or should I put it in a specific pluggin ? I copied the whole thing just after the comment /* no view is returned by this class. This is because this class serves as the parent class for individual fragments and each of those child classes return their own views (plugins have their own view)... */ I only changed the AdUnitID by the test ID given on the Admob developer page. 5. I found the onDestroy in BT_activity_host, and it actually looks like this : //onDestroy @Override public void onDestroy() { BT_debugger.showIt(activityName + ":onDestroy"); super.onDestroy(); //added by Nico for Interstitial Ad if (interstitial.isLoaded()) { interstitial.show(); } //hide loading message if it's showing... if(this.loadingMessage != null){ if(this.loadingMessage.isShowing()){ this.loadingMessage.hide(); } } Result is I'm getting a bunch of errors : Error:(123, 3) error: cannot find symbol variable interstitial Error:(123, 22) error: cannot find symbol class InterstitialAd Error:(124, 3) error: cannot find symbol variable interstitial Error:(125, 3) error: cannot find symbol class AdRequest Error:(125, 38) error: package AdRequest does not exist Error:(126, 3) error: cannot find symbol variable interstitial Error:(263, 7) error: cannot find symbol variable interstitial Error:(264, 4) error: cannot find symbol variable interstitial Help please ? Nico
 
NicoRacing
Lost but trying
Profile
Posts: 78
Reg: Oct 25, 2013
Hyeres
3,680
like
12/16/15 01:24 PM (9 years ago)
Got it sorted with Dusko's help. KennedyE's info are actually very clear, I just needed to add myself some onstart / ondestroy lines in the plugin. Cheers guys ! NIco
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.