├── 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 | 2 | 3 | Ant build script for Titanium Android module admob 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /build/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/.DS_Store -------------------------------------------------------------------------------- /build/.apt_generated/com/studioclassics/admob/AdMobViewProxyBindingGen.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Appcelerator Titanium Mobile 3 | * Copyright (c) 2010 by Appcelerator, Inc. All Rights Reserved. 4 | * Licensed under the terms of the Apache Public License 5 | * Please see the LICENSE included with this distribution for details. 6 | */ 7 | package com.studioclassics.admob; 8 | 9 | import org.appcelerator.kroll.KrollArgument; 10 | import org.appcelerator.kroll.KrollProxy; 11 | import org.appcelerator.kroll.KrollConverter; 12 | import org.appcelerator.kroll.KrollInvocation; 13 | import org.appcelerator.kroll.KrollMethod; 14 | import org.appcelerator.kroll.KrollModule; 15 | import org.appcelerator.kroll.KrollProxyBinding; 16 | import org.appcelerator.kroll.KrollModuleBinding; 17 | import org.appcelerator.kroll.KrollDynamicProperty; 18 | import org.appcelerator.kroll.KrollReflectionProperty; 19 | import org.appcelerator.kroll.KrollInjector; 20 | import org.appcelerator.kroll.KrollDict; 21 | import org.appcelerator.kroll.KrollDefaultValueProvider; 22 | import org.appcelerator.kroll.util.KrollReflectionUtils; 23 | import org.appcelerator.kroll.util.KrollBindingUtils; 24 | import org.appcelerator.titanium.kroll.KrollBridge; 25 | import org.appcelerator.titanium.TiContext; 26 | import org.appcelerator.titanium.util.Log; 27 | 28 | import org.mozilla.javascript.Scriptable; 29 | 30 | import java.util.HashMap; 31 | 32 | import com.studioclassics.admob.AdMobViewProxy; 33 | 34 | 35 | /* WARNING: this code is generated for binding methods in Android */ 36 | public class AdMobViewProxyBindingGen 37 | extends org.appcelerator.titanium.proxy.TiViewProxyBindingGen 38 | { 39 | private static final String TAG = "AdMobViewProxyBindingGen"; 40 | 41 | private static final String METHOD_requestAd = "requestAd"; 42 | private static final String METHOD_requestTestAd = "requestTestAd"; 43 | 44 | public AdMobViewProxyBindingGen() { 45 | super(); 46 | // Constants are pre-bound 47 | 48 | bindings.put(METHOD_requestAd, null); 49 | bindings.put(METHOD_requestTestAd, null); 50 | 51 | } 52 | 53 | public void bindContextSpecific(KrollBridge bridge, KrollProxy proxy) { 54 | } 55 | 56 | @Override 57 | public Object getBinding(String name) { 58 | Object value = bindings.get(name); 59 | if (value != null) { 60 | return value; 61 | } 62 | 63 | 64 | 65 | 66 | 67 | 68 | // Methods 69 | if (name.equals(METHOD_requestAd)) { 70 | KrollMethod requestAd_method = new KrollMethod(METHOD_requestAd) { 71 | public Object invoke(KrollInvocation __invocation, Object[] __args) throws Exception 72 | { 73 | 74 | 75 | Object __requestAd_tmp; 76 | 77 | 78 | 79 | 80 | ((AdMobViewProxy) __invocation.getProxy()).requestAd( 81 | ); 82 | return KrollProxy.UNDEFINED; 83 | } 84 | }; 85 | bindings.put(METHOD_requestAd, requestAd_method); 86 | return requestAd_method; 87 | } 88 | 89 | if (name.equals(METHOD_requestTestAd)) { 90 | KrollMethod requestTestAd_method = new KrollMethod(METHOD_requestTestAd) { 91 | public Object invoke(KrollInvocation __invocation, Object[] __args) throws Exception 92 | { 93 | 94 | 95 | Object __requestTestAd_tmp; 96 | 97 | 98 | 99 | 100 | ((AdMobViewProxy) __invocation.getProxy()).requestTestAd( 101 | ); 102 | return KrollProxy.UNDEFINED; 103 | } 104 | }; 105 | bindings.put(METHOD_requestTestAd, requestTestAd_method); 106 | return requestTestAd_method; 107 | } 108 | 109 | 110 | return super.getBinding(name); 111 | } 112 | 113 | private static final String SHORT_API_NAME = "AdMobView"; 114 | private static final String FULL_API_NAME = "Admob.AdMobView"; 115 | private static final String ID = "com.studioclassics.admob.AdMobViewProxy"; 116 | 117 | public String getAPIName() { 118 | return FULL_API_NAME; 119 | } 120 | 121 | public String getShortAPIName() { 122 | return SHORT_API_NAME; 123 | } 124 | 125 | public String getId() { 126 | return ID; 127 | } 128 | 129 | public KrollModule newInstance(TiContext context) { 130 | return null; 131 | } 132 | 133 | public Class getProxyClass() { 134 | return AdMobViewProxy.class; 135 | } 136 | 137 | public boolean isModule() { 138 | return false; 139 | } 140 | } -------------------------------------------------------------------------------- /build/.apt_generated/com/studioclassics/admob/AdmobModuleBindingGen.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Appcelerator Titanium Mobile 3 | * Copyright (c) 2010 by Appcelerator, Inc. All Rights Reserved. 4 | * Licensed under the terms of the Apache Public License 5 | * Please see the LICENSE included with this distribution for details. 6 | */ 7 | package com.studioclassics.admob; 8 | 9 | import org.appcelerator.kroll.KrollArgument; 10 | import org.appcelerator.kroll.KrollProxy; 11 | import org.appcelerator.kroll.KrollConverter; 12 | import org.appcelerator.kroll.KrollInvocation; 13 | import org.appcelerator.kroll.KrollMethod; 14 | import org.appcelerator.kroll.KrollModule; 15 | import org.appcelerator.kroll.KrollProxyBinding; 16 | import org.appcelerator.kroll.KrollModuleBinding; 17 | import org.appcelerator.kroll.KrollDynamicProperty; 18 | import org.appcelerator.kroll.KrollReflectionProperty; 19 | import org.appcelerator.kroll.KrollInjector; 20 | import org.appcelerator.kroll.KrollDict; 21 | import org.appcelerator.kroll.KrollDefaultValueProvider; 22 | import org.appcelerator.kroll.util.KrollReflectionUtils; 23 | import org.appcelerator.kroll.util.KrollBindingUtils; 24 | import org.appcelerator.titanium.kroll.KrollBridge; 25 | import org.appcelerator.titanium.TiContext; 26 | import org.appcelerator.titanium.util.Log; 27 | 28 | import org.mozilla.javascript.Scriptable; 29 | 30 | import java.util.HashMap; 31 | 32 | import com.studioclassics.admob.AdmobModule; 33 | 34 | 35 | /* WARNING: this code is generated for binding methods in Android */ 36 | public class AdmobModuleBindingGen 37 | extends org.appcelerator.kroll.KrollModuleBindingGen 38 | { 39 | private static final String TAG = "AdmobModuleBindingGen"; 40 | 41 | private static final String CONST_AD_RECEIVED = "AD_RECEIVED"; 42 | private static final String CONST_AD_NOT_RECEIVED = "AD_NOT_RECEIVED"; 43 | private static final String CREATE_AdMobView = "createAdMobView"; 44 | private static final String DYNPROP_adNotReceived = "adNotReceived"; 45 | private static final String DYNPROP_adReceived = "adReceived"; 46 | private static final String METHOD_setTesting = "setTesting"; 47 | private static final String METHOD_setPublisherId = "setPublisherId"; 48 | 49 | public AdmobModuleBindingGen() { 50 | super(); 51 | // Constants are pre-bound 52 | bindings.put(CONST_AD_RECEIVED, AdmobModule.AD_RECEIVED); 53 | bindings.put(CONST_AD_NOT_RECEIVED, AdmobModule.AD_NOT_RECEIVED); 54 | 55 | bindings.put(CREATE_AdMobView, null); 56 | bindings.put(DYNPROP_adNotReceived, null); 57 | bindings.put(DYNPROP_adReceived, null); 58 | bindings.put(METHOD_setTesting, null); 59 | bindings.put(METHOD_setPublisherId, null); 60 | 61 | } 62 | 63 | public void bindContextSpecific(KrollBridge bridge, KrollProxy proxy) { 64 | } 65 | 66 | @Override 67 | public Object getBinding(String name) { 68 | Object value = bindings.get(name); 69 | if (value != null) { 70 | return value; 71 | } 72 | 73 | // Proxy create methods 74 | if (name.equals(CREATE_AdMobView)) { 75 | KrollBindingUtils.KrollProxyCreator creator = new KrollBindingUtils.KrollProxyCreator() { 76 | public KrollProxy create(TiContext context) { 77 | return new com.studioclassics.admob.AdMobViewProxy(context); 78 | } 79 | }; 80 | KrollMethod createAdMobView_method = KrollBindingUtils.createCreateMethod(CREATE_AdMobView, creator); 81 | bindings.put(CREATE_AdMobView, createAdMobView_method); 82 | return createAdMobView_method; 83 | } 84 | 85 | 86 | 87 | 88 | // Dynamic Properties 89 | if (name.equals(DYNPROP_adNotReceived)) { 90 | KrollDynamicProperty adNotReceived_property = new KrollDynamicProperty(DYNPROP_adNotReceived, 91 | true, false, 92 | false) { 93 | 94 | @Override 95 | public Object dynamicGet(KrollInvocation __invocation) { 96 | 97 | 98 | Object __getAdNotReceived_tmp; 99 | final org.appcelerator.kroll.KrollConverter __getAdNotReceived_converter = org.appcelerator.kroll.KrollConverter.getInstance(); 100 | 101 | 102 | java.lang.String __retVal = 103 | 104 | 105 | ((AdmobModule) __invocation.getProxy()).getAdNotReceived( 106 | ); 107 | return __getAdNotReceived_converter.convertNative(__invocation, __retVal); 108 | } 109 | 110 | @Override 111 | public void dynamicSet(KrollInvocation __invocation, Object __value) { 112 | Log.w(TAG, "Property Admob.adNotReceived isn't writable"); 113 | } 114 | }; 115 | adNotReceived_property.setJavascriptConverter(org.appcelerator.kroll.KrollConverter.getInstance()); 116 | adNotReceived_property.setNativeConverter(org.appcelerator.kroll.KrollConverter.getInstance()); 117 | bindings.put(DYNPROP_adNotReceived, adNotReceived_property); 118 | return adNotReceived_property; 119 | } 120 | 121 | if (name.equals(DYNPROP_adReceived)) { 122 | KrollDynamicProperty adReceived_property = new KrollDynamicProperty(DYNPROP_adReceived, 123 | true, false, 124 | false) { 125 | 126 | @Override 127 | public Object dynamicGet(KrollInvocation __invocation) { 128 | 129 | 130 | Object __getAdReceived_tmp; 131 | final org.appcelerator.kroll.KrollConverter __getAdReceived_converter = org.appcelerator.kroll.KrollConverter.getInstance(); 132 | 133 | 134 | java.lang.String __retVal = 135 | 136 | 137 | ((AdmobModule) __invocation.getProxy()).getAdReceived( 138 | ); 139 | return __getAdReceived_converter.convertNative(__invocation, __retVal); 140 | } 141 | 142 | @Override 143 | public void dynamicSet(KrollInvocation __invocation, Object __value) { 144 | Log.w(TAG, "Property Admob.adReceived isn't writable"); 145 | } 146 | }; 147 | adReceived_property.setJavascriptConverter(org.appcelerator.kroll.KrollConverter.getInstance()); 148 | adReceived_property.setNativeConverter(org.appcelerator.kroll.KrollConverter.getInstance()); 149 | bindings.put(DYNPROP_adReceived, adReceived_property); 150 | return adReceived_property; 151 | } 152 | 153 | // Methods 154 | if (name.equals(METHOD_setTesting)) { 155 | KrollMethod setTesting_method = new KrollMethod(METHOD_setTesting) { 156 | public Object invoke(KrollInvocation __invocation, Object[] __args) throws Exception 157 | { 158 | 159 | KrollBindingUtils.assertRequiredArgs(__args, 1, METHOD_setTesting); 160 | 161 | Object __setTesting_tmp; 162 | KrollArgument __testing_argument = new KrollArgument("testing"); 163 | java.lang.Boolean testing; 164 | __testing_argument.setOptional(false); 165 | 166 | __setTesting_tmp = org.appcelerator.kroll.KrollConverter.getInstance().convertJavascript(__invocation, __args[0], java.lang.Boolean.class); 167 | try { 168 | testing = (java.lang.Boolean) __setTesting_tmp; 169 | } catch (ClassCastException e) { 170 | throw new IllegalArgumentException("Expected java.lang.Boolean type for argument \"testing\" in \"setTesting\", but got " + __setTesting_tmp); 171 | } 172 | __testing_argument.setValue(testing); 173 | __invocation.addArgument(__testing_argument); 174 | 175 | 176 | 177 | 178 | ((AdmobModule) __invocation.getProxy()).setTesting( 179 | testing 180 | ); 181 | return KrollProxy.UNDEFINED; 182 | } 183 | }; 184 | bindings.put(METHOD_setTesting, setTesting_method); 185 | return setTesting_method; 186 | } 187 | 188 | if (name.equals(METHOD_setPublisherId)) { 189 | KrollMethod setPublisherId_method = new KrollMethod(METHOD_setPublisherId) { 190 | public Object invoke(KrollInvocation __invocation, Object[] __args) throws Exception 191 | { 192 | 193 | KrollBindingUtils.assertRequiredArgs(__args, 1, METHOD_setPublisherId); 194 | 195 | Object __setPublisherId_tmp; 196 | KrollArgument __pubId_argument = new KrollArgument("pubId"); 197 | java.lang.String pubId; 198 | __pubId_argument.setOptional(false); 199 | 200 | __setPublisherId_tmp = org.appcelerator.kroll.KrollConverter.getInstance().convertJavascript(__invocation, __args[0], java.lang.String.class); 201 | try { 202 | pubId = (java.lang.String) __setPublisherId_tmp; 203 | } catch (ClassCastException e) { 204 | throw new IllegalArgumentException("Expected java.lang.String type for argument \"pubId\" in \"setPublisherId\", but got " + __setPublisherId_tmp); 205 | } 206 | __pubId_argument.setValue(pubId); 207 | __invocation.addArgument(__pubId_argument); 208 | 209 | 210 | 211 | 212 | ((AdmobModule) __invocation.getProxy()).setPublisherId( 213 | pubId 214 | ); 215 | return KrollProxy.UNDEFINED; 216 | } 217 | }; 218 | bindings.put(METHOD_setPublisherId, setPublisherId_method); 219 | return setPublisherId_method; 220 | } 221 | 222 | 223 | return super.getBinding(name); 224 | } 225 | 226 | private static final String SHORT_API_NAME = "Admob"; 227 | private static final String FULL_API_NAME = "Admob"; 228 | private static final String ID = "com.studioclassics.admob"; 229 | 230 | public String getAPIName() { 231 | return FULL_API_NAME; 232 | } 233 | 234 | public String getShortAPIName() { 235 | return SHORT_API_NAME; 236 | } 237 | 238 | public String getId() { 239 | return ID; 240 | } 241 | 242 | public KrollModule newInstance(TiContext context) { 243 | return new AdmobModule(context); 244 | } 245 | 246 | public Class getProxyClass() { 247 | return AdmobModule.class; 248 | } 249 | 250 | public boolean isModule() { 251 | return true; 252 | } 253 | } -------------------------------------------------------------------------------- /build/.apt_generated/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","constants":{"AD_NOT_RECEIVED":{"name":"AD_NOT_RECEIVED","proxyName":"AD_NOT_RECEIVED","type":"java.lang.String"},"AD_RECEIVED":{"name":"AD_RECEIVED","proxyName":"AD_RECEIVED","type":"java.lang.String"}},"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/classes/com/studioclassics/admob/AdMobView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdMobView.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdMobViewProxy.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdMobViewProxy.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdMobViewProxyBindingGen$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdMobViewProxyBindingGen$1.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdMobViewProxyBindingGen$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdMobViewProxyBindingGen$2.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdMobViewProxyBindingGen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdMobViewProxyBindingGen.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModule.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModule.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModuleBindingGen$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModuleBindingGen$1.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModuleBindingGen$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModuleBindingGen$2.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModuleBindingGen$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModuleBindingGen$3.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModuleBindingGen$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModuleBindingGen$4.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModuleBindingGen$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModuleBindingGen$5.class -------------------------------------------------------------------------------- /build/classes/com/studioclassics/admob/AdmobModuleBindingGen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkurzius/Titanium-Android-AdMob-Module/cdf87dbf73fc685336503b3ebb5d5b2d578edee7/build/classes/com/studioclassics/admob/AdmobModuleBindingGen.class -------------------------------------------------------------------------------- /build/classes/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","constants":{"AD_NOT_RECEIVED":{"name":"AD_NOT_RECEIVED","proxyName":"AD_NOT_RECEIVED","type":"java.lang.String"},"AD_RECEIVED":{"name":"AD_RECEIVED","proxyName":"AD_RECEIVED","type":"java.lang.String"}},"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/docs/index.html: -------------------------------------------------------------------------------- 1 |

admob Module

2 |

Description

3 |

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 |

Accessing the admob Module

9 |

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 |

Reference

14 |

setPublisherId(String id);

15 |

Set your publisher id

16 |

Usage

17 |

admob.setPublisherId("123456");

18 |

setTesting(Boolean testing);

19 |

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 |

Usage

22 |

admob.setTesting(false);

23 |

createAdMobView()

24 |

returns a view with an ad initialized by default

25 |

Usage

26 |

var adMobView = admob.createAdMobView();

27 |

admob.AD_RECEIVED

28 |

returns the constant for AD_RECEIVED -- for use in an event listener

29 |

Usage

30 |

adMobView.addEventListener(admob.AD_RECEIVED,function(){ 31 | alert("ad was just received"); 32 | });

33 |

admob.AD_NOT_RECEIVED

34 |

returns the constant for AD_NOT_RECEIVED -- for use in an event listener

35 |

Usage

36 |

adMobView.addEventListener(admob.AD_NOT_RECEIVED,function(){ 37 | alert("ad was not received"); 38 | });

39 |

AdMobView.requestAd();

40 |

calls for a new ad if needed

41 |

Usage

42 |

adMobView.requestAd();

43 |

AdMobView.requestTestAd();

44 |

calls for a test ad if needed. This works independently from the testing flag above

45 |

Usage

46 |

adMobView.requestTestAd();

47 |

Author

48 |

Brian Kurzius | bkurzius@gmail.com

49 |

License

50 |

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 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------