Recent

Author Topic: Support for AdMob!  (Read 6840 times)

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Support for AdMob!
« on: July 05, 2018, 08:18:01 am »
Hi guys, I've managed to support AdMob on LAMW. This mode:

First we need download: gradle 4.1 https://gradle.org/next-steps/?version=4.1&format=bin and install.

Second, we need to create a appCompat gradle project, and set the path of Gradle [LAMW] Android Module Wizard -> Paths Settings

Three, install the SDK components for AdMob:
Android Support Repository - Google Play services -  Google Repository

Fourth, add "compile 'com.google.android.gms: play-services-ads: 11.0.4'" to the project file "buidl.gradle"

Fifth, add the following code in the "Controls.java" file in the "jForm" class in the constructor:

Code: Java  [Select][+][-]
  1.         import com.google.android.gms.ads.AdRequest;
  2.         import com.google.android.gms.ads.AdView;
  3.         import com.google.android.gms.ads.MobileAds;
  4.         import com.google.android.gms.ads.AdSize;
  5.  
  6.         // ..... constructor
  7.  
  8.         String banner_id = "ca-app-pub-3940256099942544/6300978111";
  9.  
  10.         MobileAds.initialize(controls.activity, banner_id);
  11.  
  12.         LayoutParams bannerLParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
  13.                                               ViewGroup.LayoutParams.WRAP_CONTENT);
  14.  
  15.         bannerLParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
  16.         bannerLParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
  17.  
  18.         AdView adView=new AdView(controls.activity);
  19.         adView.setLayoutParams(bannerLParams);
  20.         adView.setAdSize(AdSize.BANNER);
  21.         adView.setAdUnitId(banner_id);
  22.         layout.addView(adView);
  23.  
  24.         //AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
  25.         AdRequest adRequest = new AdRequest.Builder().build();
  26.  
  27.         // Start loading the ad in the background.
  28.        adView.loadAd(adRequest);

Attached AdMob component and modifications in the latest version of LAMW.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Support for AdMob!
« Reply #1 on: July 05, 2018, 04:49:43 pm »

Hi tr3e!

Great Work!

Congratulations!

I will commit your solutions to github!

Thank you!!!!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: Support for AdMob!
« Reply #2 on: July 05, 2018, 04:54:11 pm »
Thankyou, this is really good news  :)

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Support for AdMob!
« Reply #3 on: July 09, 2018, 03:07:54 am »

Hi all!

Please, someone can convert "admod.rar" to "admod.zip"  ...  ;D  O:-)

Thanks.
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Support for AdMob!
« Reply #4 on: July 09, 2018, 03:11:33 am »

Hi all!

Please, someone can convert "admod.rar" to "admod.zip"  ...  ;D  O:-)

Thanks.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Support for AdMob!
« Reply #5 on: July 09, 2018, 03:16:53 am »

@engkin,

its working!

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: Support for AdMob!
« Reply #6 on: July 13, 2018, 06:22:57 pm »
I have created an example of use for AdMob.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Support for AdMob!
« Reply #7 on: July 13, 2018, 06:47:27 pm »
I have created an example of use for AdMob.
I'd rather have the opposite: don't bother me with advertising or at least - the basic minimum - no targeted advertising. (Nobody wants that, only marketeers.)
Anyway I will find a way to make such code explode.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: Support for AdMob!
« Reply #8 on: July 13, 2018, 07:07:09 pm »
I have created an example of use for AdMob.
I'd rather have the opposite: don't bother me with advertising or at least - the basic minimum - no targeted advertising. (Nobody wants that, only marketeers.)
Anyway I will find a way to make such code explode.

You yourself, I simply give you the option. If you want to take it and if not.

I do not like publicity either, nor many things of this life. But you have to do everything in life.

And if not, look at the bottom of the page and see this advertising.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Support for AdMob!
« Reply #9 on: August 01, 2018, 11:49:50 pm »

Hi TR3E!

the "AppAdMobDemo" is incomplete?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Support for AdMob!
« Reply #10 on: August 05, 2018, 07:40:35 am »
Hi,  TR3E!

The "jsAdMob"  was added to LAMW git repository!

and the demo, too: "AppCompatAdMobDemo1"

Thank you!

PS. "js" is for "Android Bridges Support" component tab
[need "AppCompat" theme!!!]


Thank you!!!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: Support for AdMob!
« Reply #11 on: August 09, 2018, 11:31:55 am »
Ok thank you, great job.

Mnggl

  • Newbie
  • Posts: 1
Re: Support for AdMob!
« Reply #12 on: July 02, 2019, 07:52:32 am »
Good news :)

ketch

  • New member
  • *
  • Posts: 8
Re: Support for AdMob!
« Reply #13 on: July 12, 2020, 08:40:50 pm »
Hi, all!

@ADiV, @jmpessoa

Is it in your plans to add Rewarded ads support for AdMob ?

Thanks.

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: Support for AdMob!
« Reply #14 on: January 13, 2021, 01:17:23 pm »
Hi, all!

@ADiV, @jmpessoa

Is it in your plans to add Rewarded ads support for AdMob ?

Thanks.

When jmpessoa uploads the latest update you will have support for Rewarded and Interstational ads.

 

TinyPortal © 2005-2018