Git Product home page Git Product logo

admob-openfl's Introduction

Google AdMob extension for OpenFL applications. Working on both Android and iOS. Code is heavily based on NMEX extension which is pretty much outdated right now. This forked version updates the Google Play Services library to the revision 20. It was only tested on Android.

Instructions

  1. Clone this repo using haxelib git admob https://github.com/mkorman9/admob-openfl command
  2. Include extension to your project <haxelib name="admob" />
  3. Import AD class import admob.AD;
  4. Setup ads at the beginning of your code AD.init(ADMOB_ID, AD.LEFT, AD.BOTTOM, AD.BANNER_PORTRAIT, false); where arguments are following:
  • Ad unit id.
  • Position in x axis. Could be AD.LEFT or AD.RIGHT
  • Position in y axis. Could be AD.TOP or AD.BOTTOM
  • Banner size. Could be AD.BANNER_PORTRAIT or AD.BANNER_LANDSCAPE (see google's documentation)
  • Test mode. Whether enable test ads or not. Default value is false.
  1. Show banner AD.show();
  2. You can hide it anytime by calling AD.hide();

Prerequisites on iOS

  1. Add following code to your project.xml
<ios linker-flags="-force_load __PATH_TO_THE_HAXELIB_DIR__/admob/git/ndll/iPhone/libGoogleAdMobAds.a" />

don't forget to replace __PATH_TO_THE_HAXELIB_DIR__ with real path to your haxelib, in most cases it will be /usr/lib/haxe/lib

  1. After creating XCode project, drag libGoogleAdMobAds.a to Project Settings->Build Phases->Link with binaries
  2. (Optional) You can rebuild binaries on Mac OSX using five simple commands:
cd __PATH_TO_THE_HAXELIB_DIR__/admob/git/project
haxelib run hxcpp Build.xml -Diphoneos
haxelib run hxcpp Build.xml -Diphoneos -DHXCPP_ARMV7
haxelib run hxcpp Build.xml -Diphonesim
haxelib run hxcpp Build.xml

Prerequisites on Android

  1. Copy android-template directory to your project
  2. Add following code to your project.xml:
<java path="android-template/libs/google-play-services.jar" if="android" />
<template path="android-template/AndroidManifest.xml" rename="AndroidManifest.xml" if="android" />
<template path="android-template/src/org/haxe/lime/GameActivity.java" rename="src/org/haxe/lime/GameActivity.java" if="android" />
<template path="android-template/res" rename="res" if="android" />

admob-openfl's People

Contributors

mkorman9 avatar sanafa avatar sergiob avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.