Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 121

miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
10/16/16 09:57 AM (8 years ago)

Revmob integration to iOS

Can anyone tell how to implement Revmob ads to iOS? Latest manuals are more than 3 years old now.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
10/16/16 05:33 PM (8 years ago)
Have you looked at the instructions on the revmob site.
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
10/16/16 10:34 PM (8 years ago)
I found this: #import <RevMobAds/RevMobAds.h> @implementation YourViewController - (void)viewDidLoad{ [super viewDidLoad]; [RevMobAds startSessionWithAppID:@"<YOUR_APP_ID>" withSuccessHandler:^{ //Custom method defined below [self showBanner]; } andFailHandler:^(NSError *error) { //For now we don't need this }]; // Your initialization code } - (void)showBanner { RevMobBanner *banner = [[RevMobAds session] banner]; banner = [[RevMobAds session] bannerView]; [banner loadWithSuccessHandler:^(RevMobBannerView *bannerV) { [banner showAd]; } andLoadFailHandler:^(RevMobBannerView *banner, NSError *error) { // Ad failed } onClickHandler:^(RevMobBannerView *banner) { // Ad clicked }]; } @end ---------------- Can you tell me where exactly should I put this in appDelegate?
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/14/16 03:02 AM (8 years ago)
have you solved this yet? If not i hope this helps if you want the ad displayed on every plugin you ad the code to your BT_viewcontroller in BT_viewcontroller.h add #import <RevMobAds/RevMobAds.h> @implementation YourViewController then in BT_viewcontroller.m under -(void)viewDidLoad{ [BT_debugger showIt:self theMessage:@"viewDidLoad (super)"]; [super viewDidLoad]; put the following [RevMobAds startSessionWithAppID:@"<YOUR_APP_ID>" withSuccessHandler:^{ //Custom method defined below [self showBanner]; } andFailHandler:^(NSError *error) { //For now we don't need this }]; // Your initialization code then before -//viewWillAppear... put the following - (void)showBanner { RevMobBanner *banner = [[RevMobAds session] banner]; banner = [[RevMobAds session] bannerView]; [banner loadWithSuccessHandler:^(RevMobBannerView *bannerV) { [banner showAd]; } andLoadFailHandler:^(RevMobBannerView *banner, NSError *error) { // Ad failed } onClickHandler:^(RevMobBannerView *banner) { // Ad clicked }]; } if you only want this displayed the ad on certain plugins you follow the same steps but adding code to BT_<plugin_name> files instead.
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
11/14/16 03:08 AM (8 years ago)
Thanks, Revmob works on iOS, but what about Revmob for Android? So far nobody gave me solution. Maybe you have it?
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/14/16 12:56 PM (8 years ago)
I will have a look later today if i get a chance and let you know. What code have you added to your project so far?
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/15/16 02:52 AM (8 years ago)
I found revmob banner ad integration very easy add the following code to BT_activity_host.java import com.revmob.RevMob; import com.revmob.RevMobAdsListener; import com.revmob.ads.link.RevMobLink; import android.util.Log; import android.view.ViewGroup; import android.widget.LinearLayout; import com.revmob.ads.banner.RevMobBanner; private RevMob revmob; RevMobBanner banner; LinearLayout layout; under //onCreate @Override public void onCreate(Bundle savedInstanceState) { find this line ---> setContentView(R.layout.bt_activity_host); and under it add startRevMobSession(); then after //configure the app's environment... configureEnvironment(); } put the following public void startRevMobSession() { //RevMob's Start Session method: revmob = RevMob.startWithListener(this, new RevMobAdsListener() { @Override public void onRevMobSessionStarted() { loadBanner(); // Cache the banner once the session is started Log.i("RevMob","Session Started"); } @Override public void onRevMobSessionNotStarted(String message) { //If the session Fails to start, no ads can be displayed. Log.i("RevMob","Session Failed to Start"); } }, "<YOUR_ID_HERE>"); } public void loadBanner(){ banner = revmob.preLoadBanner(this, new RevMobAdsListener(){ @Override public void onRevMobAdReceived() { showBanner(); Log.i("RevMob","Banner Ready to be Displayed"); //At this point, the banner is ready to be displayed. } @Override public void onRevMobAdNotReceived(String message) { Log.i("RevMob","Banner Not Failed to Load"); } @Override public void onRevMobAdDisplayed() { Log.i("RevMob","Banner Displayed"); } }); } public void showBanner(){ runOnUiThread(new Runnable() { @Override public void run() { ViewGroup view = (ViewGroup) findViewById(R.id.bannerLayout); view.addView(banner); banner.show(); //This method must be called in order to display the ad. } }); } then your BT_activity_host.xml should look like the following <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/containerView" android:background="@android:color/white" android:padding="0dip" android:layout_margin="0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/backgroundSolidColorView" android:background="@android:color/transparent" android:padding="0dip" android:layout_margin="0dip" android:layout_width="fill_parent" android:layout_height="fill_parent"> </RelativeLayout> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/backgroundImageBox" android:background="@android:color/transparent" android:padding="0dip" android:layout_margin="0dip" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/backgroundImageView" android:layout_width="fill_parent" android:layout_height="fill_parent"> </ImageView> </RelativeLayout> <!-- Full screen linear layout, fragments (plugins) run in this "box" --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragmentBox" android:orientation="vertical" android:background="@android:color/transparent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/bannerLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical"> </LinearLayout> </LinearLayout> </FrameLayout> using this code successfully added rev mob banner ad to top of every plugin. Hope this helps! Kristan Halls Immaculate Apps
 
immacul8 apps
Aspiring developer
Profile
Posts: 58
Reg: Sep 10, 2012
adelaide
580
like
11/15/16 02:56 AM (8 years ago)
 

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.