ti.admob icon indicating copy to clipboard operation
ti.admob copied to clipboard

full example for Interstitial android

Open fadaytak opened this issue 9 years ago • 13 comments

hi

have you a full sample for supporting android Interstitial???

this one doesn't work

var adMobInterstitial = admob.createView({
publisherId:"ca-app-pub-924XXXXXXXXXXXXXXXXXXXXXXXXXX2",
testing:false, // default is false
//top: 10, //optional
//left: 0, // optional
//right: 0, // optional
bottom: 2, // optional
adBackgroundColor:"#eff0f0", // optional
backgroundColorTop: "#eff0f0", //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
adUnitId : 'ca-app-pub-924XXXXXXXXXXXXXXXXXXXXXXXXXX2', // You can get your own at http: //www.admob.com/
isInterstitial : true
//primaryTextColor: "blue", // deprecated -- now maps to textColor
//secondaryTextColor: "green" // deprecated -- now maps to linkColor
});

//listener for adReceived
adMobInterstitial.addEventListener(admob.AD_RECEIVED,function(){
// alert("ad received");
Ti.API.info("adMobInterstitial - ad received");
});

//listener for adNotReceived
adMobInterstitial.addEventListener(admob.AD_NOT_RECEIVED,function(){
//alert("ad not received");
 Ti.API.info("adMobInterstitial - ad not received");
});

$.windowRoot.add(adMobInterstitial);

$.windowRoot.open();

and the result is :

Ads: Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
Ads: CsiReporterFactory: CSI is not enabled. No CSI reporter created.
Ads: No fill from ad server.
dalvikvm: Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.s.g.<init>
dalvikvm: VFY: unable to resolve virtual method 3153: Landroid/webkit/WebSettings;.setMixedContentMode (I)V
Ads: Failed to load ad: 3

fadaytak avatar Mar 24 '15 23:03 fadaytak

The error message is referring to the need for a theme in the ad activity like this:

<activity

                android:configChanges=

"keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"

                android:name="com.google.android.gms.ads.AdActivity"

                android:screenOrientation="portrait" android:theme=

"@android:style/Theme.Translucent"/>

This should be added to the tiapp.xml file in the android/manifest/application section.

Let me know if you need more information.

Brian Caufield

On Tue, Mar 24, 2015 at 7:11 PM, fadaytak [email protected] wrote:

hi

have you a full sample for supporting android Interstitial???

this one doesn't work

var adMobInterstitial = admob.createView({ publisherId:"ca-app-pub-924XXXXXXXXXXXXXXXXXXXXXXXXXX2", testing:false, // default is false //top: 10, //optional //left: 0, // optional //right: 0, // optional bottom: 2, // optional adBackgroundColor:"#eff0f0", // optional backgroundColorTop: "#eff0f0", //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 adUnitId : 'ca-app-pub-924XXXXXXXXXXXXXXXXXXXXXXXXXX2', // You can get your own at http: //www.admob.com/ isInterstitial : true //primaryTextColor: "blue", // deprecated -- now maps to textColor //secondaryTextColor: "green" // deprecated -- now maps to linkColor });

//listener for adReceived adMobInterstitial.addEventListener(admob.AD_RECEIVED,function(){ // alert("ad received");Ti.API.info("adMobInterstitial - ad received"); });

//listener for adNotReceived adMobInterstitial.addEventListener(admob.AD_NOT_RECEIVED,function(){ //alert("ad not received"); Ti.API.info("adMobInterstitial - ad not received"); });

$.windowRoot.add(adMobInterstitial);

$.windowRoot.open();

and the result is :

Ads: Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad. Ads: CsiReporterFactory: CSI is not enabled. No CSI reporter created. Ads: No fill from ad server. dalvikvm: Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.s.g. dalvikvm: VFY: unable to resolve virtual method 3153: Landroid/webkit/WebSettings;.setMixedContentMode (I)V Ads: Failed to load ad: 3

— Reply to this email directly or view it on GitHub https://github.com/appcelerator-modules/ti.admob/issues/33.

bcaufield avatar Mar 25 '15 10:03 bcaufield

thank you for your response

shoud i use a specific version of module?

in the release section, we have more than one version

https://github.com/appcelerator-modules/ti.admob/releases

cordially

fadaytak avatar Mar 25 '15 11:03 fadaytak

You are usually best using the latest version but you have to test to see if it supports the features you are looking for.

Personally on android, I gave up on ti.admob and went with https://github.com/ndizazzo/android-parse-titanium-module, he also has support for Smart Banners which are needed to support android's many device sizes, particularly 7" tablets. There is a working example of an interstitial ad too, which is always a plus.

On Wed, Mar 25, 2015 at 7:50 AM, fadaytak [email protected] wrote:

thank you for your response

shoud i use a specific version of module?

in the release section, we have more than one version

https://github.com/appcelerator-modules/ti.admob/releases

cordially

— Reply to this email directly or view it on GitHub https://github.com/appcelerator-modules/ti.admob/issues/33#issuecomment-85995501 .

bcaufield avatar Mar 25 '15 18:03 bcaufield

From my side the didreceivead event is strange. You have to show ad to get it to trigger. Resulting you must show an empty window, getting all the main app to not respond if not ad is received. I did manage to get something with a little work.Also I didn't manage to get your fork to display interstititial with ios8. For the time being, I only use banner ads. Was working fine with ios7. Regards

elberto avatar Mar 25 '15 19:03 elberto

with this

<activity android:configChanges= "keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity" android:screenOrientation="portrait" android:theme= "@android:style/Theme.Translucent"/>

there is no error message, thank you... but there is no ads

and i have new one

[ERROR] :  GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

i have an error message of google play services

any idea?

cordially

fadaytak avatar Mar 25 '15 23:03 fadaytak

I never got interstitials working properly with this module either, in my branch I added some of the function calls for interstitials but I gave up when I found the AdMob Pro module in the marketplace: https://marketplace.appcelerator.com/apps/5670 This one just works.

On Wed, Mar 25, 2015 at 7:10 PM, fadaytak [email protected] wrote:

with this

there is no error message, thank you... but there is no ads

and i have new one

[ERROR] : GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

i have an error message of google play services

any idea?

cordially

— Reply to this email directly or view it on GitHub https://github.com/appcelerator-modules/ti.admob/issues/33#issuecomment-86249000 .

bcaufield avatar Mar 26 '15 13:03 bcaufield

Oh, and you can safely ignore the Google play services not found error - I believe it is a known issue and doesn't affect the ad functionality.

On Thu, Mar 26, 2015 at 9:21 AM, Brian Caufield [email protected] wrote:

I never got interstitials working properly with this module either, in my branch I added some of the function calls for interstitials but I gave up when I found the AdMob Pro module in the marketplace: https://marketplace.appcelerator.com/apps/5670 This one just works.

On Wed, Mar 25, 2015 at 7:10 PM, fadaytak [email protected] wrote:

with this

there is no error message, thank you... but there is no ads

and i have new one

[ERROR] : GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

i have an error message of google play services

any idea?

cordially

— Reply to this email directly or view it on GitHub https://github.com/appcelerator-modules/ti.admob/issues/33#issuecomment-86249000 .

bcaufield avatar Mar 26 '15 13:03 bcaufield

I'm having the same problem. I can not activate the interstitial android.

michelmelo avatar Apr 24 '15 13:04 michelmelo

I've made some changes to source code of ti.admob module and got worked interstitial ads properly and added support for smart banner. The main thing, is that module dont have support of interstitial ads in the version on GitHub. Oh, and other issue is - be carefull of using that version, its not destroying admob view properly and after closing your app still running and trying to get ads, check the logs after closing app.

bitk0der avatar May 06 '15 20:05 bitk0der

@bcaufield you said on your 25th march comment that https://github.com/ndizazzo/android-parse-titanium-module has a working example of an interstitial ad too, which is always a plus but I am not able to find it. Can you please share a link if you have?

mitulbhalia avatar May 12 '15 09:05 mitulbhalia

I wish to display an interstitial, but when I use the code, only a normal banner is displayed on bottom. Anybody has same issue? I did'n open another issue due it's related to this one.

Using this module (v2.1.5 from https://github.com/appcelerator-modules/ti.admob/releases/tag/android-2.1.5) and the code in https://github.com/appcelerator-modules/ti.admob/issues/33#issue-64124165.

fcjurado avatar May 19 '15 14:05 fcjurado

A bit confused, are there versions of this (or any) module that display interstitial ads for either/both iOS and Android?

tvfoodmaps avatar Jun 25 '15 19:06 tvfoodmaps

Did anyone manage to get this working?

deckameron avatar May 04 '16 01:05 deckameron