├── LICENSE
├── README
├── assets
└── README
├── bin
├── .DS_Store
├── com
│ ├── .DS_Store
│ └── studioclassics
│ │ ├── .DS_Store
│ │ └── admob
│ │ ├── AdMobView.class
│ │ ├── AdMobViewProxy.class
│ │ ├── AdMobViewProxyBindingGen$1.class
│ │ ├── AdMobViewProxyBindingGen$2.class
│ │ ├── AdMobViewProxyBindingGen.class
│ │ ├── AdmobModule.class
│ │ ├── AdmobModuleBindingGen$1.class
│ │ ├── AdmobModuleBindingGen$2.class
│ │ ├── AdmobModuleBindingGen$3.class
│ │ ├── AdmobModuleBindingGen$4.class
│ │ ├── AdmobModuleBindingGen$5.class
│ │ └── AdmobModuleBindingGen.class
└── org
│ └── appcelerator
│ └── titanium
│ └── bindings
│ └── admob.json
├── build.properties
├── build.xml
├── build
├── .DS_Store
├── .apt_generated
│ ├── com
│ │ └── studioclassics
│ │ │ └── admob
│ │ │ ├── AdMobViewProxyBindingGen.java
│ │ │ └── AdmobModuleBindingGen.java
│ └── org
│ │ └── appcelerator
│ │ └── titanium
│ │ └── bindings
│ │ └── admob.json
├── classes
│ ├── com
│ │ └── studioclassics
│ │ │ └── admob
│ │ │ ├── AdMobView.class
│ │ │ ├── AdMobViewProxy.class
│ │ │ ├── AdMobViewProxyBindingGen$1.class
│ │ │ ├── AdMobViewProxyBindingGen$2.class
│ │ │ ├── AdMobViewProxyBindingGen.class
│ │ │ ├── AdmobModule.class
│ │ │ ├── AdmobModuleBindingGen$1.class
│ │ │ ├── AdmobModuleBindingGen$2.class
│ │ │ ├── AdmobModuleBindingGen$3.class
│ │ │ ├── AdmobModuleBindingGen$4.class
│ │ │ ├── AdmobModuleBindingGen$5.class
│ │ │ └── AdmobModuleBindingGen.class
│ └── org
│ │ └── appcelerator
│ │ └── titanium
│ │ └── bindings
│ │ └── admob.json
└── docs
│ └── index.html
├── dist
├── admob.jar
└── com.studioclassics.admob-android-0.1.zip
├── documentation
└── index.md
├── example
└── app.js
├── hooks
├── README
├── add.py
├── install.py
├── remove.py
└── uninstall.py
├── lib
├── .DS_Store
└── GoogleAdMobAdsSdk-4.1.0.jar
├── manifest
├── platform
└── README
├── res
└── .DS_Store
├── src
├── .DS_Store
└── com
│ ├── .DS_Store
│ └── studioclassics
│ ├── .DS_Store
│ └── admob
│ ├── AdMobView.java
│ ├── AdMobViewProxy.java
│ └── AdmobModule.java
└── timodule.xml
/LICENSE:
--------------------------------------------------------------------------------
1 | TODO: place your license here and we'll include it in the module distribution
2 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/README
--------------------------------------------------------------------------------
/assets/README:
--------------------------------------------------------------------------------
1 | Place your assets like PNG files in this directory and they will be packaged with your module.
2 |
3 | If you create a file named com.studioclassics.admob.js in this directory, it will be
4 | compiled and used as your module. This allows you to run pure Javascript
5 | modules that are pre-compiled.
6 |
7 |
--------------------------------------------------------------------------------
/bin/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/.DS_Store
--------------------------------------------------------------------------------
/bin/com/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/.DS_Store
--------------------------------------------------------------------------------
/bin/com/studioclassics/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/.DS_Store
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdMobView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdMobView.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdMobViewProxy.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdMobViewProxy.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdMobViewProxyBindingGen$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdMobViewProxyBindingGen$1.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdMobViewProxyBindingGen$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdMobViewProxyBindingGen$2.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdMobViewProxyBindingGen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdMobViewProxyBindingGen.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModule.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModule.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModuleBindingGen$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModuleBindingGen$1.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModuleBindingGen$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModuleBindingGen$2.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModuleBindingGen$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModuleBindingGen$3.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModuleBindingGen$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModuleBindingGen$4.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModuleBindingGen$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModuleBindingGen$5.class
--------------------------------------------------------------------------------
/bin/com/studioclassics/admob/AdmobModuleBindingGen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/bin/com/studioclassics/admob/AdmobModuleBindingGen.class
--------------------------------------------------------------------------------
/bin/org/appcelerator/titanium/bindings/admob.json:
--------------------------------------------------------------------------------
1 | {"modules":{"com.studioclassics.admob.AdmobModule":{"apiName":"Admob","createProxies":[{"proxyClassName":"com.studioclassics.admob.AdMobViewProxy","id":"com.studioclassics.admob.AdMobViewProxy","propertyAccessors":[],"isTopLevel":false,"name":"AdMobView","creatableInModule":"com.studioclassics.admob.AdmobModule","fullAPIName":"Admob.AdMobView"}]}},"proxies":{"com.studioclassics.admob.AdmobModule":{"methods":{"setTesting":{"hasInvocation":false,"apiName":"setTesting","args":[{"defaultValueProvider":"org.appcelerator.kroll.KrollConverter","converter":"org.appcelerator.kroll.KrollConverter","sourceName":"testing","name":"testing","type":"java.lang.Boolean"}],"converter":"org.appcelerator.kroll.KrollConverter","runOnUiThread":false,"name":"__default_name__","returnType":"void"},"setPublisherId":{"hasInvocation":false,"apiName":"setPublisherId","args":[{"defaultValueProvider":"org.appcelerator.kroll.KrollConverter","converter":"org.appcelerator.kroll.KrollConverter","sourceName":"pubId","name":"pubId","type":"java.lang.String"}],"converter":"org.appcelerator.kroll.KrollConverter","runOnUiThread":false,"name":"__default_name__","returnType":"void"}},"proxyClassName":"AdmobModule","proxyAttrs":{"proxyClassName":"com.studioclassics.admob.AdmobModule","id":"com.studioclassics.admob","propertyAccessors":[],"isTopLevel":false,"contextSpecific":false,"name":"Admob","fullAPIName":"Admob"},"superProxyBindingClassName":"org.appcelerator.kroll.KrollModuleBindingGen","packageName":"com.studioclassics.admob","dynamicProperties":{"adNotReceived":{"getMethodArgs":[],"javascriptConverter":"org.appcelerator.kroll.KrollConverter","getDefaultProviders":[],"get":true,"getMethodName":"getAdNotReceived","getHasInvocation":false,"set":false,"runOnUiThread":false,"name":"adNotReceived","getReturnType":"java.lang.String","nativeConverter":"org.appcelerator.kroll.KrollConverter","setHasInvocation":false},"adReceived":{"getMethodArgs":[],"javascriptConverter":"org.appcelerator.kroll.KrollConverter","getDefaultProviders":[],"get":true,"getMethodName":"getAdReceived","getHasInvocation":false,"set":false,"runOnUiThread":false,"name":"adReceived","getReturnType":"java.lang.String","nativeConverter":"org.appcelerator.kroll.KrollConverter","setHasInvocation":false}},"sourceName":"com.studioclassics.admob.AdmobModuleBindingGen","genClassName":"AdmobModuleBindingGen","isModule":true},"com.studioclassics.admob.AdMobViewProxy":{"methods":{"requestAd":{"hasInvocation":false,"apiName":"requestAd","args":[],"converter":"org.appcelerator.kroll.KrollConverter","runOnUiThread":false,"name":"__default_name__","returnType":"void"},"requestTestAd":{"hasInvocation":false,"apiName":"requestTestAd","args":[],"converter":"org.appcelerator.kroll.KrollConverter","runOnUiThread":false,"name":"__default_name__","returnType":"void"}},"proxyClassName":"AdMobViewProxy","proxyAttrs":{"proxyClassName":"com.studioclassics.admob.AdMobViewProxy","id":"com.studioclassics.admob.AdMobViewProxy","propertyAccessors":[],"isTopLevel":false,"name":"AdMobView","creatableInModule":"com.studioclassics.admob.AdmobModule","fullAPIName":"Admob.AdMobView"},"superProxyBindingClassName":"org.appcelerator.titanium.proxy.TiViewProxyBindingGen","packageName":"com.studioclassics.admob","sourceName":"com.studioclassics.admob.AdMobViewProxyBindingGen","genClassName":"AdMobViewProxyBindingGen","isModule":false}}}
--------------------------------------------------------------------------------
/build.properties:
--------------------------------------------------------------------------------
1 | titanium.platform=/Library/Application Support/Titanium/mobilesdk/osx/1.7.0-20110512/android
2 | android.platform=/android-sdk/platforms/android-7
3 | google.apis=/android-sdk/add-ons/addon_google_apis_google_inc_7
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
Allows for the display of AdMob in Titanium Android applications.
4 |Please note that if your androidManifest has screen support set to: android:anyDensity="false", 5 | any banner ads will display too small on high density devices. 6 | It is not clear at this point if this is a bug with adMob or Titanium. 7 | In any event, you will either need to NOT set your screen support -- or set android:anyDensity="true" and adjust your app layout accordingly
8 |To access this module from JavaScript, you would do the following:
10 |var admob = require("com.studioclassics.admob");
11 |
12 | The admob variable is a reference to the Module object.
13 |Set your publisher id
16 |admob.setPublisherId("123456");
18 |set if the ads should be test ads or not -- 20 | default is false so you only need to call this if you want to set it to true
21 |admob.setTesting(false);
23 |returns a view with an ad initialized by default
25 |var adMobView = admob.createAdMobView();
27 |returns the constant for AD_RECEIVED -- for use in an event listener
29 |adMobView.addEventListener(admob.AD_RECEIVED,function(){ 31 | alert("ad was just received"); 32 | });
33 |returns the constant for AD_NOT_RECEIVED -- for use in an event listener
35 |adMobView.addEventListener(admob.AD_NOT_RECEIVED,function(){ 37 | alert("ad was not received"); 38 | });
39 |calls for a new ad if needed
41 |adMobView.requestAd();
43 |calls for a test ad if needed. This works independently from the testing flag above
45 |adMobView.requestTestAd();
47 |Brian Kurzius | bkurzius@gmail.com
49 |Apache License
-------------------------------------------------------------------------------- /dist/admob.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/dist/admob.jar -------------------------------------------------------------------------------- /dist/com.studioclassics.admob-android-0.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/dist/com.studioclassics.admob-android-0.1.zip -------------------------------------------------------------------------------- /documentation/index.md: -------------------------------------------------------------------------------- 1 | # admob Module 2 | 3 | ## Description 4 | 5 | Allows for the display of AdMob in Titanium Android applications. 6 | 7 | Please note that if your androidManifest has screen support set to: android:anyDensity="false", 8 | any banner ads will display too small on high density devices. 9 | It is not clear at this point if this is a bug with adMob or Titanium. 10 | In any event, you will either need to NOT set your screen support -- or set android:anyDensity="true" and adjust your app layout accordingly 11 | 12 | ## Accessing the admob Module 13 | 14 | To access this module from JavaScript, you would do the following: 15 | 16 | var admob = require("com.studioclassics.admob"); 17 | 18 | The admob variable is a reference to the Module object. 19 | 20 | # Reference 21 | 22 | ## setPublisherId(String id); 23 | 24 | Set your publisher id 25 | 26 | ### Usage 27 | admob.setPublisherId("123456"); 28 | 29 | 30 | ## setTesting(Boolean testing); 31 | 32 | set if the ads should be test ads or not -- 33 | default is false so you only need to call this if you want to set it to true 34 | 35 | ### Usage 36 | admob.setTesting(false); 37 | 38 | 39 | ## createAdMobView() 40 | 41 | returns a view with an ad initialized by default 42 | 43 | ### Usage 44 | var adMobView = admob.createAdMobView(); 45 | 46 | ## admob.AD_RECEIVED 47 | 48 | returns the constant for AD_RECEIVED -- for use in an event listener 49 | 50 | ### Usage 51 | adMobView.addEventListener(admob.AD_RECEIVED,function(){ 52 | alert("ad was just received"); 53 | }); 54 | 55 | ## admob.AD_NOT_RECEIVED 56 | 57 | returns the constant for AD_NOT_RECEIVED -- for use in an event listener 58 | 59 | ### Usage 60 | adMobView.addEventListener(admob.AD_NOT_RECEIVED,function(){ 61 | alert("ad was not received"); 62 | }); 63 | 64 | 65 | ## AdMobView.requestAd(); 66 | 67 | calls for a new ad if needed 68 | 69 | ### Usage 70 | 71 | adMobView.requestAd(); 72 | 73 | ## AdMobView.requestTestAd(); 74 | 75 | calls for a test ad if needed. This works independently from the testing flag above 76 | 77 | ### Usage 78 | 79 | adMobView.requestTestAd(); 80 | 81 | 82 | 83 | # Author 84 | 85 | Brian Kurzius | bkurzius@gmail.com 86 | 87 | # License 88 | 89 | Apache License 90 | -------------------------------------------------------------------------------- /example/app.js: -------------------------------------------------------------------------------- 1 | var win = Titanium.UI.createWindow({ 2 | backgroundColor: "#FFFFFF", 3 | layout: "vertical" 4 | }); 5 | 6 | // require AdMob 7 | var admob = require("com.studioclassics.admob"); 8 | 9 | // set your publisher id 10 | admob.setPublisherId("a14de00df64415f"); 11 | 12 | // set if the ads should be test ads or not -- 13 | // default is false so you only need to call this if you want to set it to true 14 | admob.setTesting(false); 15 | 16 | // then create an adMob view 17 | var adMobView = admob.createAdMobView(); 18 | 19 | //listener for adReceived 20 | adMobView.addEventListener(admob.AD_RECEIVED,function(){ 21 | alert("ad was just received"); 22 | }); 23 | 24 | //listener for adNotReceived 25 | adMobView.addEventListener(admob.AD_NOT_RECEIVED,function(){ 26 | alert("ad was not received"); 27 | }); 28 | 29 | 30 | var adRequestBtn = Ti.UI.createButton({ 31 | title:"Request ad", 32 | top:10, 33 | height: 30, 34 | width: 200 35 | }); 36 | 37 | adRequestBtn.addEventListener("click",function(){ 38 | adMobView.requestAd(); 39 | }); 40 | 41 | var adRequestBtn2 = Ti.UI.createButton({ 42 | title: "Request test ad", 43 | top: 10, 44 | height: 30, 45 | width: 200 46 | }); 47 | 48 | adRequestBtn2.addEventListener("click",function(){ 49 | adMobView.requestTestAd(); 50 | }); 51 | 52 | win.add(adMobView); 53 | win.add(adRequestBtn); 54 | win.add(adRequestBtn2); 55 | win.open(); -------------------------------------------------------------------------------- /hooks/README: -------------------------------------------------------------------------------- 1 | These files are not yet supported as of 1.4.0 but will be in a near future release. 2 | -------------------------------------------------------------------------------- /hooks/add.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project add hook that will be 4 | # called when your module is added to a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your add hook here (optional) 26 | 27 | 28 | # exit 29 | sys.exit(0) 30 | 31 | 32 | 33 | if __name__ == '__main__': 34 | main(sys.argv,len(sys.argv)) 35 | 36 | -------------------------------------------------------------------------------- /hooks/install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module install hook that will be 4 | # called when your module is first installed 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your install hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | 17 | if __name__ == '__main__': 18 | main(sys.argv,len(sys.argv)) 19 | 20 | -------------------------------------------------------------------------------- /hooks/remove.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module project remove hook that will be 4 | # called when your module is remove from a project 5 | # 6 | import os, sys 7 | 8 | def dequote(s): 9 | if s[0:1] == '"': 10 | return s[1:-1] 11 | return s 12 | 13 | def main(args,argc): 14 | # You will get the following command line arguments 15 | # in the following order: 16 | # 17 | # project_dir = the full path to the project root directory 18 | # project_type = the type of project (desktop, mobile, ipad) 19 | # project_name = the name of the project 20 | # 21 | project_dir = dequote(os.path.expanduser(args[1])) 22 | project_type = dequote(args[2]) 23 | project_name = dequote(args[3]) 24 | 25 | # TODO: write your remove hook here (optional) 26 | 27 | # exit 28 | sys.exit(0) 29 | 30 | 31 | 32 | if __name__ == '__main__': 33 | main(sys.argv,len(sys.argv)) 34 | 35 | -------------------------------------------------------------------------------- /hooks/uninstall.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # This is the module uninstall hook that will be 4 | # called when your module is uninstalled 5 | # 6 | import os, sys 7 | 8 | def main(args,argc): 9 | 10 | # TODO: write your uninstall hook here (optional) 11 | 12 | # exit 13 | sys.exit(0) 14 | 15 | 16 | if __name__ == '__main__': 17 | main(sys.argv,len(sys.argv)) 18 | 19 | -------------------------------------------------------------------------------- /lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/lib/.DS_Store -------------------------------------------------------------------------------- /lib/GoogleAdMobAdsSdk-4.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/lib/GoogleAdMobAdsSdk-4.1.0.jar -------------------------------------------------------------------------------- /manifest: -------------------------------------------------------------------------------- 1 | # 2 | # this is your module manifest and used by Titanium 3 | # during compilation, packaging, distribution, etc. 4 | # 5 | version: 0.1 6 | description: My module 7 | author: Your Name 8 | license: Specify your license 9 | copyright: Copyright (c) 2011 by Your Company 10 | 11 | 12 | # these should not be edited 13 | name: admob 14 | moduleid: com.studioclassics.admob 15 | guid: 2fa4573e-29b1-4f32-be23-935e7407e461 16 | platform: android 17 | minsdk: 1.7.0-20110512 18 | -------------------------------------------------------------------------------- /platform/README: -------------------------------------------------------------------------------- 1 | You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module. 2 | 3 | When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder. 4 | -------------------------------------------------------------------------------- /res/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/res/.DS_Store -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/src/.DS_Store -------------------------------------------------------------------------------- /src/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/src/com/.DS_Store -------------------------------------------------------------------------------- /src/com/studioclassics/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/src/com/studioclassics/.DS_Store -------------------------------------------------------------------------------- /src/com/studioclassics/admob/AdMobView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 by Studio Classics. All Rights Reserved. 3 | * Licensed under the terms of the Apache Public License 4 | * Please see the LICENSE included with this distribution for details. 5 | */ 6 | package com.studioclassics.admob; 7 | 8 | import org.appcelerator.kroll.KrollDict; 9 | import org.appcelerator.titanium.proxy.TiViewProxy; 10 | import org.appcelerator.titanium.util.Log; 11 | import org.appcelerator.titanium.view.TiUIView; 12 | 13 | import android.app.Activity; 14 | 15 | import com.google.ads.Ad; 16 | import com.google.ads.AdListener; 17 | import com.google.ads.AdRequest; 18 | import com.google.ads.AdSize; 19 | import com.google.ads.AdView; 20 | 21 | public class AdMobView extends TiUIView implements AdListener 22 | { 23 | private static final String LCAT = "AdMobView"; 24 | AdView adView; 25 | Activity thisActivity; 26 | 27 | public AdMobView(final TiViewProxy proxy) { 28 | 29 | super(proxy); 30 | 31 | Log.d(LCAT, "Creating an adMob ad"); 32 | // get the publisher id that was set in the module 33 | Log.d(LCAT, "AdmobModule.PUBLISHER_ID: " + AdmobModule.PUBLISHER_ID); 34 | thisActivity = (Activity) proxy.getTiContext().getActivity(); 35 | // create the adView 36 | adView = new AdView(thisActivity, AdSize.BANNER, AdmobModule.PUBLISHER_ID); 37 | // Create an ad request. 38 | AdRequest adRequest = new AdRequest(); 39 | // Fill out ad request 40 | // determine testing based on Module variable 41 | adRequest.setTesting(AdmobModule.TESTING); 42 | // Start loading the ad in the background. 43 | adView.loadAd(adRequest); 44 | // set the listener 45 | adView.setAdListener(this); 46 | // Add the AdView to your view hierarchy. 47 | // The view will have no size until the ad is loaded. 48 | setNativeView(adView); 49 | 50 | } 51 | 52 | @Override 53 | public void processProperties(KrollDict d){ 54 | super.processProperties(d); 55 | Log.d(LCAT, "process properties"); 56 | } 57 | 58 | // pass the method the TESTING flag 59 | public void requestAd() { 60 | Log.d(LCAT, "requestAd()"); 61 | // pass the TESTING flag 62 | loadAd(AdmobModule.TESTING); 63 | } 64 | 65 | // pass true to requestAd(Boolean testing) -- regardless of what the module has set 66 | public void requestTestAd() { 67 | Log.d(LCAT, "requestTestAd()"); 68 | loadAd(true); 69 | } 70 | 71 | // load the adMob ad 72 | public void loadAd(Boolean testing) { 73 | Log.d(LCAT, "requestAd(Boolean testing) -- testing:" + testing); 74 | AdRequest adRequest = new AdRequest(); 75 | adRequest.setTesting(testing); 76 | adView.loadAd(adRequest); 77 | } 78 | 79 | // required methods for the AdListener interface 80 | public void onReceiveAd(Ad ad){ 81 | Log.d(LCAT, "onReceiveAd()"); 82 | proxy.fireEvent(AdmobModule.AD_RECEIVED, new KrollDict()); 83 | } 84 | public void onFailedToReceiveAd(Ad ad, AdRequest.ErrorCode e){ 85 | Log.d(LCAT, "onFailedToReceiveAd(): " + e); 86 | proxy.fireEvent(AdmobModule.AD_NOT_RECEIVED, new KrollDict()); 87 | } 88 | 89 | // not used 90 | public void onLeaveApplication(Ad ad){ 91 | Log.d(LCAT, "onLeaveApplication()"); 92 | } 93 | public void onPresentScreen(Ad ad){ 94 | Log.d(LCAT, "onPresentScreen()"); 95 | } 96 | public void onDismissScreen(Ad ad){ 97 | Log.d(LCAT, "onDismissScreen()"); 98 | } 99 | 100 | 101 | 102 | } 103 | 104 | -------------------------------------------------------------------------------- /src/com/studioclassics/admob/AdMobViewProxy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 by Studio Classics. All Rights Reserved. 3 | * Licensed under the terms of the Apache Public License 4 | * Please see the LICENSE included with this distribution for details. 5 | */ 6 | package com.studioclassics.admob; 7 | 8 | import org.appcelerator.kroll.KrollDict; 9 | import org.appcelerator.kroll.annotations.Kroll; 10 | import org.appcelerator.titanium.TiContext; 11 | import org.appcelerator.titanium.proxy.TiViewProxy; 12 | import org.appcelerator.titanium.util.Log; 13 | import org.appcelerator.titanium.view.TiUIView; 14 | 15 | import android.app.Activity; 16 | 17 | @Kroll.proxy(creatableInModule=AdmobModule.class) 18 | public class AdMobViewProxy extends TiViewProxy 19 | { 20 | private AdMobView adMob; 21 | private static final String LCAT = "AdMobViewProxy"; 22 | 23 | public AdMobViewProxy(TiContext tiContext) 24 | { 25 | super(tiContext); 26 | } 27 | 28 | @Override 29 | protected KrollDict getLangConversionTable() { 30 | KrollDict table = new KrollDict(); 31 | table.put("title","titleid"); 32 | return table; 33 | } 34 | 35 | @Override 36 | public TiUIView createView(Activity activity){ 37 | adMob = new AdMobView(this); 38 | return adMob; 39 | } 40 | 41 | @Kroll.method 42 | public void requestAd() { 43 | Log.d(LCAT, "requestAd()"); 44 | adMob.requestAd(); 45 | } 46 | @Kroll.method 47 | public void requestTestAd() { 48 | Log.d(LCAT, "requestTestAd(): "); 49 | adMob.requestTestAd(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/com/studioclassics/admob/AdmobModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 by Studio Classics. All Rights Reserved. 3 | * Licensed under the terms of the Apache Public License 4 | * Please see the LICENSE included with this distribution for details. 5 | */ 6 | 7 | package com.studioclassics.admob; 8 | 9 | import org.appcelerator.kroll.KrollModule; 10 | import org.appcelerator.kroll.annotations.Kroll; 11 | import org.appcelerator.titanium.TiContext; 12 | import org.appcelerator.titanium.util.Log; 13 | 14 | 15 | @Kroll.module(name="Admob", id="com.studioclassics.admob") 16 | public class AdmobModule extends KrollModule 17 | { 18 | // Standard Debugging variables 19 | private static final String LCAT = "AdmobModule"; 20 | public static String MODULE_NAME = "AndroidAdMobModule"; 21 | @Kroll.constant public static final String AD_RECEIVED = "ad_received"; 22 | @Kroll.constant public static final String AD_NOT_RECEIVED = "ad_not_received"; 23 | public static Boolean TESTING = false; 24 | public static String PUBLISHER_ID; 25 | 26 | 27 | public AdmobModule(TiContext tiContext) { 28 | super(tiContext); 29 | Log.d(LCAT, ">>>adMob module instantiated"); 30 | } 31 | 32 | // use this to set the publisher id 33 | // must be done before the call to instantiate the view 34 | @Kroll.method 35 | public void setPublisherId(String pubId) { 36 | Log.d(LCAT, "setPublisherId(): " + pubId); 37 | PUBLISHER_ID = pubId; 38 | } 39 | 40 | @Kroll.method 41 | public void setTesting(Boolean testing) { 42 | Log.d(LCAT, "setTesting(): " + testing); 43 | TESTING = testing; 44 | } 45 | 46 | 47 | // ******* Deprecated************ 48 | 49 | // Properties 50 | @Kroll.getProperty 51 | public String getAdReceived() { 52 | Log.d(LCAT, "getAdReceived()"); 53 | return AD_RECEIVED; 54 | } 55 | 56 | @Kroll.getProperty 57 | public String getAdNotReceived() { 58 | Log.d(LCAT, "getAdNotReceived()"); 59 | return AD_NOT_RECEIVED; 60 | } 61 | 62 | // ******* Deprecated************ 63 | 64 | 65 | 66 | } -------------------------------------------------------------------------------- /timodule.xml: -------------------------------------------------------------------------------- 1 | 2 |