Allows for the display of AdMob in Titanium Android applications.
Please note that if your androidManifest has screen support set to: android:anyDensity="false", any banner ads will display too small on high density devices. It is not clear at this point if this is a bug with AdMob or Titanium. In any event, you will either need to NOT set your screen support -- or set android:anyDensity="true" and adjust your app layout accordingly
View the Using Titanium Modules document for instructions on getting started with using this module in your application.
Add this to the <android /> node in tiapp.xml:
<android>
<tool-api-level>14</tool-api-level>
</android>
To access this module from JavaScript, you would do the following (recommended):
var Admob = require('ti.admob');
The "Admob" variable is now a reference to the Module object.
https://developers.google.com/mobile-ads-sdk/
Returns a number value indicating the availability of Google Play Services which are for push notifications.
Possible values include SUCCESS
, SERVICE_MISSING
, SERVICE_VERSION_UPDATE_REQUIRED
, SERVICE_DISABLED
, and SERVICE_INVALID
.
Returns a view with an ad initialized by default.
parameters[object]: a dictionary object of properties.
var adMobView = Admob.createAdMobView({
publisherId: "<<YOUR PUBLISHER ID HERE>>",
testing:false, // default is false
top: 0, //optional
left: 0, // optional
right: 0, // optional
bottom: 0 // optional
adBackgroundColor:"FF8800", // optional
backgroundColorTop: "738000", //optional - Gradient background color at top
borderColor: "#000000", // optional - Border color
textColor: "#000000", // optional - Text color
urlColor: "#00FF00", // optional - URL color
linkColor: "#0000FF" //optional - Link text color
primaryTextColor: "blue", // deprecated -- now maps to textColor
secondaryTextColor: "green" // deprecated -- now maps to linkColor
});
returns the constant for AD_RECEIVED -- for use in an event listener
adMobView.addEventListener(Admob.AD_RECEIVED,function(){
alert("ad was just received");
});
returns the constant for AD_NOT_RECEIVED -- for use in an event listener
adMobView.addEventListener(Admob.AD_NOT_RECEIVED,function(){
alert("ad was not received");
});
Calls for a new ad if needed.
adMobView.requestAd();
Calls for a test ad if needed. This works independently from the testing flag above.
adMobView.requestTestAd();
Returned by isGooglePlayServicesAvailable
if the connection to Google Play services was successful.
Returned by isGooglePlayServicesAvailable
if Google Play services is missing on this device.
Returned by isGooglePlayServicesAvailable
if the installed version of Google Play services is out of date.
Returned by isGooglePlayServicesAvailable
if the installed version of Google Play services has been disabled on this device.
Returned by isGooglePlayServicesAvailable
if the version of the Google Play services installed on this device is not authentic.
View the change log for this module.
Please direct all questions, feedback, and concerns to info@appcelerator.com.
Brian Kurzius | bkurzius@gmail.com
Copyright 2011 Brian Kurzius, Studio Classics. Please see the LICENSE file included in the distribution for further details.