https://github.com/codenameone/admobfullscreen-codenameone
Automatically exported from code.google.com/p/admobfullscreen-codenameone
https://github.com/codenameone/admobfullscreen-codenameone
Last synced: 29 days ago
JSON representation
Automatically exported from code.google.com/p/admobfullscreen-codenameone
- Host: GitHub
- URL: https://github.com/codenameone/admobfullscreen-codenameone
- Owner: codenameone
- Fork: true (chen-fishbein/admobfullscreen-codenameone)
- Created: 2018-11-05T08:55:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-02-08T15:53:48.000Z (about 1 year ago)
- Last Synced: 2025-07-11T08:46:16.767Z (7 months ago)
- Language: Java
- Size: 17.7 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# admobfullscreen-codenameone
A Codename One library project that uses Admob Interstitial Ads
to display full screen ads - https://developers.google.com/mobile-ads-sdk/docs/admob/android/interstitial
The library is implemented for Android, iOS and the Simulator
Thanks for Ram for contributing.(the creator of yhomework)
# Sample Code
```java
public class MyApplication {
private Form current;
private AdMobManager admob;
public void init(Object context) {
try {
Resources theme = Resources.openLayered("/theme");
UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
} catch(IOException e){
e.printStackTrace();
}
String admobId = "";
if(Display.getInstance().getPlatformName().equals("ios")){
admobId = "";
}
admob = new AdMobManager(admobId);
}
public void start() {
if(current != null){
current.show();
return;
}
Form f = new Form("FullScreen Ads");
f.addComponent(new Button(new Command("start"){
public void actionPerformed(ActionEvent evt) {
admob.loadAd();
}
}));
f.addComponent(new Button(new Command("show"){
public void actionPerformed(ActionEvent evt) {
admob.showAdIfLoaded();
}
}));
f.addComponent(new Button(new Command("load & show"){
public void actionPerformed(ActionEvent evt) {
admob.loadAndShow();
}
}));
f.show();
}
public void stop() {
current = Display.getInstance().getCurrent();
}
public void destroy() {
}
}
```
# Details
## Adding to Maven App Projects
Add dependency to your common/pom.xml file:
```xml
com.codenameone
admob-fullscreen-lib
LATEST
pom
```
## Adding to Ant App Projects
Add the "admob-fullscreen" plugin through Codename One extensions (in Codename One Settings)
## iOS Build Hints
On iOS, you need to add the the following to your `ios.plistInject` build hint:
```xml
GADApplicationIdentifier
... your Admob App ID...
```
e.g.
```properties
ios.plistInject=GADApplicationIdentifierca-app-pub-394025xxxxxxxx
```
## Android Build Hints
Add the following to your `android.xapplication` build hint:
```
```
If you don't have an Admob App ID, you can create one [here](https://admob.google.com).
## Example Project
See a basic sample Maven project [here](https://github.com/shannah/fullscreenadstest).
## Build from Source
Requirements:
1. JDK 1.8 or 11
Steps:
1. Clone the repo
2. `mvn install`
This will install the lib into your local maven repo. If you want to use this in your maven project, you may need to adjust the `` in your app project's dependency to match the `` in the library pom.xml file.
This will also build a cn1lib in the common/target directory that you can install into Ant app projects by copying it to the app project's cn1libs directory, and running "Refresh CN1libs"