Gideros AdMob Plugin for Android to display and manipulate AdMob ads.

You can find example Gideros project, example Android project with plugin source and plugin folder for installation.
 

Contents

Download

Installation

Download AdMob SDK and include it in your project. To do that, right click on project and select properties, from there select "Java Build Path" and click on "Add External JARs..." and navigate to downloaded SDK jar file.

Then go to Order and Export tab and check added Admob jar file

Add this to your Android manifest file

<activity 
android:configChanges="keyboard|keyboardHidden|orientation|
screenLayout|uiMode|screenSize|smallestScreenSize" 
android:name="com.google.ads.AdActivity">
</activity>

Next you'll need to include plugin files into your exported android project. You can simply copy contents of AdMobPlugin folder into your project folder.

Or step by step, add libadmob.so files to according directories of your exported Gideros project (libs/armeabi and libs/armeabi-v7a) and AdMob.java to "src/com/giderosmobile/android/plugins" directory and copy main.xml file into "res/layout".

Then you need to open main Activity inside "src/com/giderosmobile/android" folder (usually named as YourApplicationActivity, where YourApplication is the name of your application).

Then import needed packages















import com.yourdomain.yourapp.R;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.FrameLayout;

Add















System.loadLibrary("admob");

Just right after















System.loadLibrary("gideros");
System.loadLibrary("luasocket");
System.loadLibrary("lfs");
System.loadLibrary("ggooglebilling");

Add AdMob class inside externalClasses using "com.giderosmobile.android.plugins.AdMob" string















static private String[] externalClasses = {
	"com.giderosmobile.android.plugins.googlebilling.GGoogleBilling",
	"com.giderosmobile.android.plugins.AdMob"
};

Then you'll need to modify some code, first comment out this line:















//setContentView(mGLView);

Add this code under the commented line:















	setContentView(R.layout.main);
	FrameLayout layout = (FrameLayout)findViewById(R.id.layout_main);
	layout.addView(mGLView);

Example codes















require 'admob'

admob.loadAd('somestring')

admob.setAlignment('center', 'top')

Timer.delayedCall(15000, function()
	admob.removeAd()
end)

Method list

Load advertisement

Back to method list

Method name loadAd(admobID, adType)
Description Load and for provided app id with provided ad type
Input parameters

string admobID - admob ID of your app

string adType - Type of an ad. Possible values:

  • banner
  • iab_banner
  • iab_leaderboard
  • iab_mrect
  • iab_skyscaper
  • smart_banner
  • interstitial

 

Example input












admob.loadAd("87u89chsd9dsfdsuf", "banner")

Remove advertisement

Back to method list

Method name removeAd()
Description Remove an ad from view

Set Position

Back to method list

Method name setAlignment(horizontal, vertical)
Description

Set Alignment of ad.

Horizontal values:

  • left
  • right
  • center

 

Vertical values:

  • top
  • bottom
  • center

 

Set horizontal alignment

Back to method list

Method name setHorizontalAlignment(horizontal)
Description Set horizontal alignment of ad.

Horizontal values:

  • left
  • right
  • center

 

Set vertical position

Back to method list

Method name setVerticalAlignment(vertical)
Description Set vertical alignment of ad.

Vertical values:

  • top
  • bottom
  • center

 

Get Alignment

Back to method list

Method name getAlignment()
Description Get Alignment of ad

Get horizontal alignment

Back to method list

Method name getHorizontalAlignment()
Description Get horizontal alignment of ad.

Get vertical alignment

Back to method list

Method name getVerticalAlignment()
Description Get vertical alignment of ad.

Set visibility of ad

Back to method list

Method name setVisible(visible)
Description Set visibility of ad.
Input parameters

bool visible - true to show ad and false to hide it

Latest changes

None for now