Android Open Source - snappyfrog G A D Banner View






From Project

Back to project page snappyfrog.

License

The source code is released under:

Apache License

If you think the Android project snappyfrog listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.robovm.bindings.admob;
/*  w  w  w  . j  a v a  2  s .  c  o  m*/
import org.robovm.apple.coregraphics.CGPoint;
import org.robovm.apple.uikit.UIView;
import org.robovm.apple.uikit.UIViewController;
import org.robovm.objc.annotation.Method;
import org.robovm.objc.annotation.NativeClass;
import org.robovm.objc.annotation.Property;
import org.robovm.rt.bro.annotation.ByVal;
import org.robovm.rt.bro.annotation.Pointer;

/** The view that displays banner ads. A minimum implementation to get an ad from within a UIViewController class is:
 * 
 * Create and setup the ad view, specifying the size and origin at {0, 0}.
 * 
 * <pre>
 * GADBannerView adView = new GADBannerView(GADAdSizeManager.banner());
 * adView.setRootViewController(this);
 * adView.setAdUnitID(&quot;ID created when registering my app&quot;);
 * </pre>
 * 
 * Place the ad view onto the screen.
 * 
 * <pre>
 * this.addSubview(adView);
 * </pre>
 * 
 * Request an ad without any additional targeting information.
 * 
 * <pre>
 * adView.loadRequest(null);
 * </pre> */
@NativeClass
public class GADBannerView extends UIView {

  /** Initializes a GADBannerView and sets it to the specified size, and specifies its placement at the top left of its superview.
   * If size is invalid, an instance of GADBannerView is not created and nil is returned instead.
   * @param size */
  public GADBannerView (GADAdSize size) {
    super((SkipInit)null);
    initObject(init(size));
  }

  /** Initializes a GADBannerView and sets it to the specified size, and specifies its placement within its superview bounds. If
   * |size| is invalid, an instance of GADBannerView is not created and nil is returned instead.
   * @param size
   * @param origin */
  public GADBannerView (GADAdSize size, CGPoint origin) {
    super((SkipInit)null);
    initObject(init(size, origin));
  }

  @Method(selector = "initWithAdSize:")
  private native @Pointer
  long init (@ByVal GADAdSize size);

  @Method(selector = "initWithAdSize:origin:")
  private native @Pointer
  long init (@ByVal GADAdSize size, @ByVal CGPoint origin);

  @Property
  public native String getAdUnitID ();

  /** Required value created in the AdSense website. Create a new ad unit for every unique placement of an ad in your application.
   * Set this to the ID assigned for this placement. Ad units are important for targeting and stats. Example values for different
   * request types: AdMob: a0123456789ABCD DFP: /0123/ca-pub-0123456789012345/my-ad-identifier AdSense:
   * ca-mb-app-pub-0123456789012345/my-ad-identifier Mediation: AB123456789ABCDE
   * @param adUnitID */
  @Property
  public native void setAdUnitID (String adUnitID);

  @Property
  public native UIViewController getRootViewController ();

  /** Required reference to the current root view controller. For example the root view controller in tab-based application would
   * be the UITabViewController.
   * @param viewController */
  @Property
  public native void setRootViewController (UIViewController viewController);

  @Property
  public native @ByVal
  GADAdSize getAdSize ();

  /** Required to set this banner view to a proper size. Never create your own GADAdSize directly. Use one of the predefined
   * standard ad sizes (such as kGADAdSizeBanner), or create one using the GADAdSizeFromCGSize method. If not using mediation,
   * then changing the adSize after an ad has been shown will cause a new request (for an ad of the new size) to be sent. If
   * using mediation, then a new request may not be sent.
   * @param adSize */
  @Property(strongRef = true)
  public native void setAdSize (@ByVal GADAdSize adSize);

  @Property
  public native GADBannerViewDelegate getDelegate ();

  /** Optional delegate object that receives state change notifications from this GADBannerView. Typically this is a
   * UIViewController, however, if you are unfamiliar with the delegate pattern it is recommended you subclass this GADBannerView
   * and make it the delegate. That avoids any chance of your application crashing if you forget to null out the delegate.
   * @param delegate */
  @Property(strongRef = true)
  public native void setDelegate (GADBannerViewDelegate delegate);

  /** Makes an ad request. Additional targeting options can be supplied with a request object. Refresh the ad by calling this
   * method again.
   * @param request */
  @Method(selector = "loadRequest:")
  public native void loadRequest (GADRequest request);

  /** @return {@code true}, if the currently displayed ad (or most recent failure) was a result of auto refreshing as specified on
   *         server. This will be set to {@code false} after each {@link #loadRequest(GADRequest)} method. */
  @Property(selector = "hasAutoRefreshed")
  public native boolean isAutoRefreshed ();

  /** @return the underlying ad view of the mediated ad network. You may use this to find out the actual size of the ad and adjust
   *         GADBannerView to fit the underlying ad view. */
  @Property
  public native UIView getMediatedAdView ();

  /** @return the ad network class name that fetched the current ad. Returns nil while the latest ad request is in progress or if
   *         the latest ad request failed. For both standard and mediated Google AdMob ads, this method returns
   *         "GADMAdapterGoogleAdMobAds". For ads fetched via mediation custom events, this method returns
   *         "GADMAdapterCustomEvents". */
  @Property
  public native String getAdNetworkClassName ();
}




Java Source Code List

com.masseranolabs.bridge.SLComposeViewController.java
com.masseranolabs.snappyfrog.AndroidServices.java
com.masseranolabs.snappyfrog.ButtonFactory.java
com.masseranolabs.snappyfrog.DesktopServices.java
com.masseranolabs.snappyfrog.Explosion.java
com.masseranolabs.snappyfrog.Frog.java
com.masseranolabs.snappyfrog.Game.java
com.masseranolabs.snappyfrog.LaserBeam.java
com.masseranolabs.snappyfrog.LevelScreen.java
com.masseranolabs.snappyfrog.MainActivity.java
com.masseranolabs.snappyfrog.MainActivity.java
com.masseranolabs.snappyfrog.Main.java
com.masseranolabs.snappyfrog.Obstacle.java
com.masseranolabs.snappyfrog.OuyaServices.java
com.masseranolabs.snappyfrog.PlatformServices.java
com.masseranolabs.snappyfrog.PowerBar.java
com.masseranolabs.snappyfrog.ResHelper.java
com.masseranolabs.snappyfrog.RobovmLauncher.java
com.masseranolabs.snappyfrog.Salary.java
com.masseranolabs.snappyfrog.ScreenshotFactory.java
com.masseranolabs.snappyfrog.StagedScreen.java
com.masseranolabs.snappyfrog.client.GwtLauncher.java
com.masseranolabs.snappyfrog.client.HtmlServices.java
com.masseranolabs.snappyfrog.iOSServices.java
org.robovm.bindings.admob.GADAdMobExtras.java
org.robovm.bindings.admob.GADAdNetworkExtras.java
org.robovm.bindings.admob.GADAdSizeManager.java
org.robovm.bindings.admob.GADAdSize.java
org.robovm.bindings.admob.GADBannerViewDelegateAdapter.java
org.robovm.bindings.admob.GADBannerViewDelegate.java
org.robovm.bindings.admob.GADBannerView.java
org.robovm.bindings.admob.GADErrorCode.java
org.robovm.bindings.admob.GADGender.java
org.robovm.bindings.admob.GADInterstitialDelegateAdapter.java
org.robovm.bindings.admob.GADInterstitialDelegate.java
org.robovm.bindings.admob.GADInterstitial.java
org.robovm.bindings.admob.GADRequestErrorConstants.java
org.robovm.bindings.admob.GADRequestError.java
org.robovm.bindings.admob.GADRequest.java
org.robovm.bindings.admob.mediation.GADCustomEventInterstitialAdapter.java
org.robovm.bindings.admob.mediation.GADCustomEventInterstitialDelegateAdapter.java
org.robovm.bindings.admob.mediation.GADCustomEventInterstitialDelegate.java
org.robovm.bindings.admob.mediation.GADCustomEventInterstitial.java
org.robovm.bindings.admob.mediation.GADCustomEventRequest.java
org.robovm.bindings.admob.sample.Sample.java