Giter VIP home page Giter VIP logo

ti.android.admob's Introduction

Ti.Android.Admob

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

Getting Started

View the Using Titanium Modules document for instructions on getting started with using this module in your application.

Requirements

For Ti.Android.Admob 9.3.14

  • Titanium SDK 10.0.0+

Doubleclick for Publishers Developer Docs

https://developers.google.com/mobile-ads-sdk/

All AdViews, except Rewarded and RewardedInterstitial, have the parameters keyword and contentUrl and can be used with DFP mapping

Download

You can get it here

How to use it

First you need add this meta-data to your tiapp.xml

<android>
    <manifest>
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">

            <!-- ========================== -->
            <!-- THIS IS THE IMPORTANT PART -->
            <meta-data
                android:name="com.google.android.gms.ads.APPLICATION_ID"
                android:value="YOUR-APP-ID"/>
            <!-- THIS IS THE IMPORTANT PART -->
            <!-- ========================== -->

            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </manifest>
</android>

You need to require the module

var Admob = require("ti.android.admob");

SETTING A TEST DEVICE (VERY IMPORTANT)

// Get your device id from the logs after you compile the project with the module for the fisrt time.
Admob.setTestDeviceId("AC65D99D31C5DA727B986DC35D45C091");

BANNER

Supported AdView Sizes

Types Description
BANNER Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels).
LARGE_BANNER Large banner ad size (320x100 density-independent pixels).
SMART_BANNER DEPRECATED - A dynamically sized banner that is full-width and auto-height.
MEDIUM_RECTANGLE Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels).
FULLBANNER Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels).
LEADERBOARD Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels).
let adView = Admob.createBanner({
    bottom : 0,

    // You can usethe supported adView sizes:
    adSize: Admob.BANNER,
    // OR a custom size, like this:
    // customAdSize: {
    //     height: 50,
    //     width: 300
    // },

    adUnitId: 'ca-app-pub-3940256099942544/6300978111', //USE YOUR AD_UNIT ID HERE

    // DFP mapping
    //keyword : "titanium",
    //contentUrl : "www.myur.com",
});
window.add(adView);

adView.addEventListener(Admob.AD_LOADED, function(e) {
    Titanium.API.info("Ad loaded");
});

adView.addEventListener(Admob.AD_FAILED_TO_LOAD, function(e) {
    Titanium.API.info("Ad failed to load");
});

ADAPTIVE BANNER

let adView = Admob.createAdaptiveBanner({  
    adUnitId: 'ca-app-pub-3940256099942544/6300978111', //USE YOUR AD_UNIT
    
    // DFP mapping
    //keyword : "titanium",
    //contentUrl : "www.myur.com",
    
    // Collapsible
    collapsible: Admob.COLLAPSIBLE_BOTTOM, // or Admob.COLLAPSIBLE_TOP

    // Adaptive Type
    adaptiveType: Admob.ADAPTIVE_INLINE, // or Admob.ADAPTIVE_ANCHORED
    maxHeight: 250 // ONLY IF adaptiveType is Admob.ADAPTIVE_INLINE, maxHeight must be set. Default value is 50
});  
window.add(adView);

adView.addEventListener(Admob.AD_LOADED, function(e) {
    Titanium.API.info("Ad loaded");
});

adView.addEventListener(Admob.AD_FAILED_TO_LOAD, function(e) {
    Titanium.API.info("Ad failed to load");
});

APP OPEN AD BANNER

/** Key Points **/  
  
// App open ads will time out after four hours. Ads rendered more than four hours after request time will no  
// longer be valid and may not earn revenue.  
  
/** Best Practices **/  
  
// Show your first app open ad after your users have used your app a few times.  
  
// Show app open ads during times when your users would otherwise be waiting for your app to load.  
  
// If you have a loading screen under the app open ad, and your loading screen completes loading before the ad  
// is dismissed, you may want to dismiss your loading screen in the onAdDismissedFullScreenContent() method.  
  
/** Warning **/  
  
// Attempting to load a new ad from the Admob.AD_FAILED_TO_LOAD event is strongly discouraged.  
// If you must load an ad from Admob.AD_FAILED_TO_LOAD, limit ad load retries to avoid continuous failed  
// ad requests in situations such as limited network connectivity.  
  
const reload_max_tries_case_error = 4;  
let reload_max_tries = 0;  
  
let appOpenAd = Admob.createAppOpenAd({  
    adUnitId: "ca-app-pub-3940256099942544/3419835294", //USE YOUR AD_UNIT
});  
  
appOpenAd.addEventListener(Admob.AD_FAILED_TO_SHOW, function (e) {
    Titanium.API.error("======================== AppOpenAd - Failed to show ads ========================");  
    Titanium.API.warn({
        "message": e.message,
        "cause": e.cause,
        "code": e.code
    });
});  
  
appOpenAd.addEventListener(Admob.AD_SHOWED_FULLSCREEN_CONTENT, function () {
    Titanium.API.info("======================== AppOpenAd - showed ads successfully ========================");
});  
  
appOpenAd.addEventListener(Admob.AD_FAILED_TO_LOAD, function (e) {
    Titanium.API.error("======================== AppOpenAd - failed to load ads ========================");
    Titanium.API.warn({
        "message": e.message,
        "reason": e.reason,
        "cause": e.cause,
        "code": e.code
    });

    if (reload_max_tries < reload_max_tries_case_error){
        appOpenAd.load();
    }

    reload_max_tries += 1;  
});  
  
appOpenAd.addEventListener(Admob.AD_LOADED, function (e) {
    Titanium.API.warn("======================== AppOpenAd - Ads Loaded and ready ========================");
    reload_max_tries = 0;
    Titanium.App.Properties.setDouble('appOpenAdLoadTime', (new Date().getTime()));
});  
  
appOpenAd.addEventListener(Admob.AD_CLOSED, function (e) {
    Titanium.API.warn("======================== AppOpenAd ad - CLOSED ========================");
    Titanium.App.Properties.setDouble('lastTimeAppOpenAdWasShown', (new Date().getTime()));
    appOpenAd.load();  
});  
  
appOpenAd.addEventListener(Admob.AD_NOT_READY, function (e) {
    Titanium.API.warn("======================== AppOpenAd ad - AD_NOT_READY ========================");
    Titanium.API.warn(e.message);  
});  
  
Titanium.App.addEventListener('resume', function () {
    let currentTime = (new Date().getTime());
    let loadTime = Titanium.App.Properties.getDouble('appOpenAdLoadTime', currentTime);
    let lastTimeAppOpenAdWasShown = Titanium.App.Properties.getDouble('lastTimeAppOpenAdWasShown', 1);
    
    if ((currentTime - loadTime) < 14400000) { // then less than 4 hours elapsed.
        if ((currentTime - lastTimeAppOpenAdWasShown) > 600000){ // then more than 10 minutes elapsed after the last Ad showed.
            appOpenAd.show();
        } else {
            Titanium.API.warn("You have showned an AppOpenAd less than 10 minutes ago. You should wait!");
        }
    } else {
        Titanium.API.warn("The AppOpenAd was requested more than 4 hours ago and has expired! You should load another one.");
    }
});

INTERSTITIAL

let interstitialAd = Admob.createInterstitial({
    adUnitId : 'ca-app-pub-3940256099942544/1033173712', //USE YOUR AD_UNIT ID HERE
});

interstitialAd.addEventListener(Admob.AD_LOADED, function(e) {
    Titanium.API.warn("Interstital Ad Received");
    interstitialAd.show();
});

interstitialAd.addEventListener(Admob.AD_FAILED_TO_LOAD, function(e) {
    Titanium.API.error("Interstital Ad failed");
    console.log(JSON.stringify(e));
});

interstitialAd.addEventListener(Admob.AD_CLOSED, function(e) {
    Titanium.API.warn("Interstital ad close successfully. RIP!");
    interstitialAd.load();
});

REWARDED INTERSTITIAL

let rewardedInterstitial = Admob.createRewardedInterstitial({
    adUnitId: 'ca-app-pub-3940256099942544/5224354917', //USE YOUR AD_UNIT ID HERE
});

rewardedInterstitial.addEventListener(Admob.AD_LOADED, function(e) {
    Titanium.API.info("Rewarded Ad AD_LOADED");
    rewardedInterstitial.show();
});

rewardedInterstitial.addEventListener(Admob.AD_REWARDED, function(e) {
    Titanium.API.info("Rewarded Ad AD_REWARDED");
    Titanium.API.info("Yay! You can give the user his reward now!");
    Titanium.API.info({
        "amount": e.amount,
        "type": e.type
    });
    rewardedInterstitial.load();
});

rewardedInterstitial.addEventListener(Admob.AD_OPENED, function(e) {
    Titanium.API.info("Rewarded Ad AD_OPENED");
});

rewardedInterstitial.addEventListener(Admob.AD_FAILED_TO_SHOW, function(e) {
    Titanium.API.info("Rewarded Ad AD_FAILED_TO_SHOW");
});

rewardedInterstitial.addEventListener(Admob.AD_CLOSED, function(e) {
    Titanium.API.info("Rewarded Ad AD_CLOSED");
});

REWARDED

let rewarded = Admob.createRewarded({
    adUnitId: 'ca-app-pub-3940256099942544/5224354917', //USE YOUR AD_UNIT ID HERE
});

rewarded.addEventListener(Admob.AD_LOADED, function(e) {
    Titanium.API.info("Rewarded Ad AD_LOADED");
    rewarded.show();
});

rewarded.addEventListener(Admob.AD_REWARDED, function(e) {
    Titanium.API.info("Rewarded Ad AD_REWARDED");
    Titanium.API.info("Yay! You can give the user his reward now!");
    Titanium.API.info({
        "amount": e.amount,
        "type": e.type
    });
    rewarded.load();
});

rewarded.addEventListener(Admob.AD_OPENED, function(e) {
    Titanium.API.info("Rewarded Ad AD_OPENED");
});

rewarded.addEventListener(Admob.AD_FAILED_TO_SHOW, function(e) {
    Titanium.API.info("Rewarded Ad AD_FAILED_TO_SHOW");
});

rewarded.addEventListener(Admob.AD_CLOSED, function(e) {
    Titanium.API.info("Rewarded Ad AD_CLOSED");
});

NATIVE ADS

let masterView = Titanium.UI.createView({
    width : Titanium.UI.FILL,
    height : Titanium.UI.SIZE,
    layout : "vertical"
});

let topView = Titanium.UI.createView({
    top : 0,
    left : 0,
    right : 0,
    height : Titanium.UI.SIZE,
    layout : "horizontal"
});
masterView.add(topView);

let contentad_logo = Titanium.UI.createImageView({
    elevation : 12,
    height : 50
});
topView.add(contentad_logo);

let contentad_advertiser = Titanium.UI.createLabel({
    color : "#575757",
    left : 16,
    textAlign : Titanium.UI.TEXT_ALIGNMENT_LEFT,
    verticalAlign : Titanium.UI.TEXT_VERTICAL_ALIGNMENT_CENTER,
    height : 35,
    font : {
        fontSize : 18,
        fontWeight : "bold"
    }
});
topView.add(contentad_advertiser);

let mediaView = Admob.createNativeAd({
    viewType : Admob.TYPE_MEDIA,
    top : 0,
    left : 0,
    right : 0,
    height : 250
});
masterView.add(mediaView);

let contentad_headline = Titanium.UI.createLabel({
    top : 16,
    maxLines : 2,
    color : "#000000",
    left : 16,
    right : 16,
    textAlign : Titanium.UI.TEXT_ALIGNMENT_LEFT,
    font : {
        fontSize : 20,
        fontWeight : "bold"
    }
});
masterView.add(contentad_headline);

let contentad_body = Titanium.UI.createLabel({
    color : "#575757",
    left : 16,
    right : 16,
    textAlign : Titanium.UI.TEXT_ALIGNMENT_LEFT,
    font : {
        fontSize : 16
    }
});
masterView.add(contentad_body);

let contentad_call_to_action = Titanium.UI.createButton({
    top : 16,
    elevation : 8,
    right : 16,
    width : Titanium.UI.SIZE,
    height : 35,
    backgroundColor : "#ff5722",
    font : {
        fontSize : 14,
        fontWeight : "bold"
    }
});
masterView.add(contentad_call_to_action);

let ratingView = Admob.createNativeAd({
    viewType : Admob.TYPE_STARS,
    left : 0,
    right : 0
});
masterView.add(ratingView);

let contentad_store_view = Titanium.UI.createLabel({
    color : "#D50000",
    top : 8,
    font : {
        fontSize : 16
    }
});
masterView.add(contentad_store_view);

let contentad_price_view = Titanium.UI.createLabel({
    color : "#575757",
    height : Titanium.UI.SIZE,
    width : Titanium.UI.SIZE,
    font : {
        fontSize : 12
    }
});
masterView.add(contentad_advertiser);

let nativeAd = Admob.createNativeAd({
    //Standard Widgets
    masterView : masterView,
    headlineLabel : contentad_headline,
    bodyLabel : contentad_body,
    callToActionButton : contentad_call_to_action,
    logoOrIconImageView : contentad_logo,
    advertiserLabel : contentad_advertiser,
    mediaView : mediaView,

    //Store Widgets
    storeLabel : contentad_store_view,
    starsView : ratingView,
    priceLabel : contentad_price_view,

    top : 16,
    left : 16,
    right : 16,
    height : Titanium.UI.SIZE,
    backgroundColor : "#FFFFFF",

    viewType : Admob.TYPE_ADS,
    adSizeType: Admob.NATIVE_ADS,
    adUnitId : "ca-app-pub-3940256099942544/2247696110",
});
window.add(nativeAd);

Events

Events Description
AD_RECEIVED (DEPRECATED) Replaced by AD_LOADED
AD_LOADED Ad is successfully loaded and ready to be displayed
AD_NOT_RECEIVED (DEPRECATED) Replaced by AD_FAILED_TO_LOAD
AD_FAILED_TO_LOAD A error occurred and the ads failed
AD_DESTROYED Ad had been successfully destroyed and wiped out of memory
AD_OPENED (BANNER) Called when an ad opens an overlay that covers the screen. (click)
AD_CLICKED (BANNER or INTERSTITIAL) Called when an ad click is validated.
AD_CLOSED (REWARDED or INTERSTITIAL) Ad had been successfully closed
AD_REWARDED (REWARDED) When the video ended successfully and you can reward you user with his prize
AD_FAILED_TO_SHOW (REWARDED or INTERSTITIAL) When the ad fails to be displayed
AD_SHOWED_FULLSCREEN_CONTENT Called when the ad showed the full screen content

Obtaining Consent with the User Messaging Platform

Prerequisites

You must have a Funding Choices account linked to your AdMob account.

To create a Funding Choices account, go to Privacy & messaging in the AdMob UI and select Go to Funding Choices. The Funding Choices account is then created automatically in the background.

For more information, see How IAB requirements affect EU consent messages.

Introduction

Under the Google EU User Consent Policy, you must make certain disclosures to your users in the European Economic Area (EEA) along with the UK and obtain their consent to use cookies or other local storage, where legally required, and to use personal data (such as AdID) to serve ads. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR).

To support publishers in meeting their duties under this policy, Google offers the User Messaging Platform (UMP) SDK, which replaces the previous open source Consent SDK. The UMP SDK has been updated to support the latest IAB standards. We've also simplified the process of setting up consent forms and listing ad providers. All of these configurations can now conveniently be handled in the Funding Choices UI.

It is a best practice to load a form every time the user launches your app, even if you determine consent is not required, so that the form is ready to display in case the user wishes to change their consent setting.

This guide walks you through how to install the SDK, implement the IAB solutions, and enable testing features.

requestConsentForm()

Request the latest consent information

It is recommended that you request an update of the consent information at every app launch. This will determine whether or not your user needs to provide consent.

We have to reset TC string if last updated date was more than 13 months ago (https://developers.google.com/admob/ios/privacy/gdpr#troubleshooting), but Google UMP has a bug that generates 3.3 typed IAB TCF v2.0 because this string never gets automatic updated. So I have implemented bocops workaround in order to address it. Thanks to Bocops and Astrovics

showConsentForm()

Presents the consent form.

Only call this method if Admod.CONSENT_REQUIRED.

resetConsentForm()

Reset consent state

In testing your app with the UMP SDK, you may find it helpful to reset the state of the SDK so that you can simulate a user's first install experience. The SDK provides the resetConsentForm() method to do this.

How to use it:

Admob.addEventListener(Admob.CONSENT_READY, function (){
    console.log("Admod.CONSENT_READY");
});

Admob.addEventListener(Admob.CONSENT_INFO_UPDATE_FAILURE, function (){
    console.log("Admod.CONSENT_INFO_UPDATE_FAILURE");
});

Admob.addEventListener(Admob.CONSENT_FORM_DISMISSED, function (){
    console.log("Admod.CONSENT_FORM_DISMISSED");
});

Admob.addEventListener(Admob.CONSENT_FORM_LOADED, function (){
    console.log("Admod.CONSENT_FORM_LOADED");
});

Admob.addEventListener(Admob.CONSENT_ERROR, function (e){
    console.log("Admod.CONSENT_ERROR");
    console.log(e.message);
});

Admob.addEventListener(Admob.CONSENT_REQUIRED, function (){  
    console.warn("Admod.CONSENT_REQUIRED");  
    Admob.showConsentForm();  
});
Admob.requestConsentForm();

User Consent and Ad serving

If consent is denied, or if certain values are not checked in the consent management phase, the ads will not be loaded.

Why does this happen? If you pay attention to the ConsentStatus.OBTAINED field, you will notice that it says that the consent is obtained, but the personalization is not defined. As you see here.

It is up to us developers to check if the user has granted the minimum requirements to be able to view the ads, and if he has chosen to see personalized or non-personalized ones.

In order to assist you with this, Mirko Dimartino created a solution that I have implemented in this module.

canShowAds()

If false (and GDPR applies, so if in EEA) you should prompt the user or to accept all, or explain in details (check above) what to check to display at least Non-Personalized Ads, or ask the user to opt for a premium version of the app, otherwise you will earn absolutely nothing.

If true you can check if user granted at least minimum requirements to show Personalized Ads with the following method.

canShowPersonalizedAds()

Finally you know if you can request AdMob Personalized or Non-Personalized Ads, if Non-Personalized you have to forward the request using this snippet.

Mediation Networks

If you want to use different mediation networks (https://developers.google.com/admob/android/choose-networks) you have to add the dependencies to your app build.gradle file. For example:

repositories {
    google()
    mavenCentral()
    maven {
        url 'https://artifact.bytedance.com/repository/pangle/'
    }
}

dependencies {
    implementation 'com.google.ads.mediation:facebook:6.13.7.1'
    implementation 'com.google.ads.mediation:inmobi:10.1.2.1'
    implementation 'com.google.ads.mediation:pangle:5.1.0.6.0'
}

Google Test Ads Ids

Events Description
Adaptative Banner ca-app-pub-3940256099942544/9214589741
Banner ca-app-pub-3940256099942544/6300978111
Interstitial ca-app-pub-3940256099942544/1033173712
Interstitial Video ca-app-pub-3940256099942544/8691691433
Rewarded Video ca-app-pub-3940256099942544/5224354917
Native ca-app-pub-3940256099942544/2247696110
AppOpen ca-app-pub-3940256099942544/3419835294

ti.android.admob's People

Contributors

astrovic avatar deckameron avatar m1ga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ti.android.admob's Issues

Failed resolution of Lcom/google/.../RewardedVideoAdListener

With ti.playservice v. 16.0+ my app crashing and appear the error on the attached image.
crash appc

With ti.playservice v. 11.0.40, my app not crashing but in console as [INFO] appears this:

Rejecting re-init on previously-failed class java.lang.Class<ti.android.admob.AdmobView$2>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/formats/UnifiedNativeAd$OnUnifiedNativeAdLoadedListener;
at org.appcelerator.titanium.view.TiUIView ti.android.admob.ViewProxy.createView(android.app.Activity) (ViewProxy.java:38)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:492)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:464)
at void org.appcelerator.titanium.proxy.TiViewProxy.add(java.lang.Object) (TiViewProxy.java:604)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(long, java.lang.Object, long, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:-2)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(org.appcelerator.kroll.KrollObject, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:63)
at boolean org.appcelerator.kroll.KrollProxy.doFireEvent(java.lang.String, java.lang.Object) (KrollProxy.java:976)
at boolean org.appcelerator.kroll.KrollProxy.handleMessage(android.os.Message) (KrollProxy.java:1256)
at boolean org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(android.os.Message) (TiViewProxy.java:267)
at boolean ti.modules.titanium.ui.WindowProxy.handleMessage(android.os.Message) (WindowProxy.java:504)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:108)
at void android.os.Looper.loop() (Looper.java:216)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7625)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:524)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:987)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.formats.UnifiedNativeAd$OnUnifiedNativeAdLoadedListener" on path: DexPathList[[zip file "/data/app/-Y3xYKN9rDTRcCFh018dqWQ==/base.apk"],nativeLibraryDirectories=[/data/app/-Y3xYKN9rDTRcCFh018dqWQ==/lib/arm64, /data/app/***-Y3xYKN9rDTRcCFh018dqWQ==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at org.appcelerator.titanium.view.TiUIView ti.android.admob.ViewProxy.createView(android.app.Activity) (ViewProxy.java:38)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:492)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:464)
at void org.appcelerator.titanium.proxy.TiViewProxy.add(java.lang.Object) (TiViewProxy.java:604)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(long, java.lang.Object, long, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:-2)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(org.appcelerator.kroll.KrollObject, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:63)
at boolean org.appcelerator.kroll.KrollProxy.doFireEvent(java.lang.String, java.lang.Object) (KrollProxy.java:976)
at boolean org.appcelerator.kroll.KrollProxy.handleMessage(android.os.Message) (KrollProxy.java:1256)
at boolean org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(android.os.Message) (TiViewProxy.java:267)
at boolean ti.modules.titanium.ui.WindowProxy.handleMessage(android.os.Message) (WindowProxy.java:504)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:108)
at void android.os.Looper.loop() (Looper.java:216)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7625)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:524)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:987)

Rejecting re-init on previously-failed class java.lang.Class<ti.android.admob.AdmobView$2>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/formats/UnifiedNativeAd$OnUnifiedNativeAdLoadedListener;
at org.appcelerator.titanium.view.TiUIView ti.android.admob.ViewProxy.createView(android.app.Activity) (ViewProxy.java:38)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:492)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:464)
at void org.appcelerator.titanium.proxy.TiViewProxy.add(java.lang.Object) (TiViewProxy.java:604)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(long, java.lang.Object, long, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:-2)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(org.appcelerator.kroll.KrollObject, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:63)
at boolean org.appcelerator.kroll.KrollProxy.doFireEvent(java.lang.String, java.lang.Object) (KrollProxy.java:976)
at boolean org.appcelerator.kroll.KrollProxy.handleMessage(android.os.Message) (KrollProxy.java:1256)
at boolean org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(android.os.Message) (TiViewProxy.java:267)
at boolean ti.modules.titanium.ui.WindowProxy.handleMessage(android.os.Message) (WindowProxy.java:504)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:108)
at void android.os.Looper.loop() (Looper.java:216)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7625)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:524)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:987)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.formats.UnifiedNativeAd$OnUnifiedNativeAdLoadedListener" on path: DexPathList[[zip file "/data/app/-Y3xYKN9rDTRcCFh018dqWQ==/base.apk"],nativeLibraryDirectories=[/data/app/-Y3xYKN9rDTRcCFh018dqWQ==/lib/arm64, /data/app/***-Y3xYKN9rDTRcCFh018dqWQ==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at org.appcelerator.titanium.view.TiUIView ti.android.admob.ViewProxy.createView(android.app.Activity) (ViewProxy.java:38)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.handleGetView() (TiViewProxy.java:492)
at org.appcelerator.titanium.view.TiUIView org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView() (TiViewProxy.java:464)
at void org.appcelerator.titanium.proxy.TiViewProxy.add(java.lang.Object) (TiViewProxy.java:604)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(long, java.lang.Object, long, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:-2)
at boolean org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(org.appcelerator.kroll.KrollObject, java.lang.String, java.lang.Object, boolean, boolean, int, java.lang.String) (V8Object.java:63)
at boolean org.appcelerator.kroll.KrollProxy.doFireEvent(java.lang.String, java.lang.Object) (KrollProxy.java:976)
at boolean org.appcelerator.kroll.KrollProxy.handleMessage(android.os.Message) (KrollProxy.java:1256)
at boolean org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(android.os.Message) (TiViewProxy.java:267)
at boolean ti.modules.titanium.ui.WindowProxy.handleMessage(android.os.Message) (WindowProxy.java:504)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:108)
at void android.os.Looper.loop() (Looper.java:216)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7625)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:524)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:987)

At the moment I use ti.playservice v. 11.0.40 but I would like use last version and resolving this problem.
My device is Huawei Honor View 20.

Using banner with listView?

Hello @deckameron me again :) I would like to learn, can I use banner ads with listView section? If I can could you give me sample code?

Thank you in advance. Really this module still good job.

Error during build: jarsigner: unable to sign jar

Full error:

[ERROR] : Failed to sign apk:
[ERROR] : jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry: org/appcelerator/titanium/gen/bindings.json

I think this happens because we use multipe modules with google-play-services.

Any idea how to fix this?

Working on SDK 6.0.2.GA.

Module not found

Hi, I am using your module (version 2.0) in Titanium (version 6.1.2.GA), but when i run my app on Android i receive this error at execution time:

[ERROR] : V8Exception: Exception occurred at ti:/module.js:305: Uncaught Error: Requested module not found: ti.android.admob

My code is the same as your example, i only change my admob publisher id

Is anybody having the same problem?
Thanks in advance

Error when compiling app project with Admob Module 3.0.4

[ERROR] Application Installer abnormal process termination. Process exit value was 1
[ERROR] : Failed to run dexer:
[ERROR] :
[ERROR] : PARSE ERROR:
[ERROR] : unsupported class file version 52.0
[ERROR] : ...while parsing com/google/ads/consent/AdProvider.class
[ERROR] : 1 error; aborting

google-play-services-base.jar version error

After last appcelerator sdk update it doesn't work yet. Is it possibile update it?

[ERROR] Application Installer abnormal process termination. Process exit value was 1
[ERROR] : Conflicting jar files detected:
[ERROR] :
[ERROR] : The following modules have different "google-play-services-base.jar" files
[ERROR] : ti.android.admob (version 2.0) (hash=730a1d6196847cb5b1067ac02a875876)
[ERROR] : ti.cloudpush (version 4.0.4) (hash=d256136c03c8f78d47ddb73739493aea)
[ERROR] :
[ERROR] : You can either select a version of these modules where the conflicting jar file is the same or you
[ERROR] : can try copying the jar file from one module's "lib" folder to the other module's "lib" folder.

Google Play services resources were not found.

Hello, im try test you module but got this message.
[ERROR] GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

Module does not work with SDK less than 7.0.0.GA

Hello!

I have a whole project based on version 6.2.2.GA of Appcelerator ... I can not upgrade yet, as it has some modules that do not support 7.0.0.GA.

Does your module have some version to work with 6.2.2.GA?

Thank you.

captura de tela 2018-04-20 as 15 09 27

deleteTCStringIfOutdated stops to work properly for v.2.2.0

It looks like AdmobModule -> deleteTCStringIfOutdated may delete the data on every launch, because of unknown changes in google updated sdk com.google.android.ump:user-messaging-platform. You have v.2.0.0, but last is v.2.2.0. Furthermore, after deletion the same number of days returns.

Support to GDPR

Hello,
are you work upgrading library to support GDPR consent requests ?
You are doing a great work with this module.

Native ads in ListView

Is is possible to implement native ads as part of listview items like after each 10 items there is native ad box?

Error using 16.x ti.playservices

Hi,
I'm trying to use module with SDK 7.5.0.GA, and all the 8.x.x.GA, but I receive the error below.
I'm not using any other module. I created a clean project and only added this module to test it.
Does anyone know what the problem might be?

[ERROR] TiExceptionHandler: (main) [20,217] No field zzckj of type Lcom/google/android/gms/internal/ads/zzwe; in class Lcom/google/android/gms/internal/ads/zzwe; or its superclasses (declaration of 'com.google.android.gms.internal.ads.zzwe' appears in base.apk)
[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler:     com.google.android.gms.internal.ads.zzyz.<init>(Unknown Source:2)
[ERROR] TiExceptionHandler:     com.google.android.gms.ads.doubleclick.PublisherAdView.<init>(Unknown Source:2)
[ERROR] TiExceptionHandler:     ti.android.admob.AdmobView.createAdView(AdmobView.java:130)
[ERROR] TiExceptionHandler:     ti.android.admob.AdmobView.processProperties(AdmobView.java:864)
[ERROR] TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1277)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:602)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:593)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:556)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:609)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:593)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:556)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:798)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:693)
[ERROR] TiExceptionHandler:     ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:269)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:624)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:783)
[ERROR] TiExceptionHandler:     org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:23)
[ERROR] TiExceptionHandler:     android.app.Activity.performCreate(Activity.java:7136)
[ERROR] TiExceptionHandler:     android.app.Activity.performCreate(Activity.java:7127)
[ERROR] TiExceptionHandler:     android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
[ERROR] TiExceptionHandler:     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
[ERROR] TiExceptionHandler:     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
[ERROR] TiExceptionHandler:     android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
[ERROR] TiExceptionHandler:     android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
[ERROR] TiExceptionHandler:     android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
[ERROR] TiExceptionHandler:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[ERROR] TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] TiExceptionHandler:     android.os.Looper.loop(Looper.java:193)
[ERROR] TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] TiExceptionHandler:     java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiExceptionHandler:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] TiExceptionHandler:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[WARN]  InputMethodManager: Ignoring onBind: cur seq=831, given seq=830

SDK 6.0.0 Support?

Unable to use module with 6.0.0.GA SDK. Will it be updated to support 6.0.0.GA SDK?

Error with Ti.Android.Admob and Ti.cloudpush

Hi @deckameron I tried to use your module to implement intertstitial ads on my app compiled with titanium sdk 5.5.1.GA. I include

<modules>
        <module platform="commonjs">ti.cloud</module>
        <module platform="android">ti.imagefactory</module>
        <module platform="android">ti.cloudpush</module>
        <module platform="android">com.rkam.swiperefreshlayout</module>
        <module platform="android">ti.inappbilling</module>
        <module platform="android">ti.android.admob</module>
</modules>

ti.cloudpush version 3.4.1
ti.android.admob version 1.0

this is my tiapp.xml

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest android:versionCode="xx" android:versionName="xx">
            <uses-sdk android:maxSdkVersion="23"
                android:minSdkVersion="16" android:targetSdkVersion="23"/>
            <uses-permission android:name="com.android.vending.BILLING"/>
            <application android:theme="@style/Theme.NoActionBar"/>
            <application android:debuggable="false"
                android:icon="@drawable/appicon" android:theme="@style/Theme.NoActionBar">
                <activity
                    android:configChanges="keyboardHidden|orientation|screenSize"
                    android:label="@string/app_name"
                    android:name=".xxxx"
                    android:screenOrientation="portrait" android:theme="@style/Theme.NoActionBar">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                </activity>
                <activity
                    android:configChanges="keyboardHidden|orientation|screenSize"
                    android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
                <activity
                    android:configChanges="keyboardHidden|orientation|screenSize"
                    android:name="org.appcelerator.titanium.TiTranslucentActivity"
                    android:screenOrientation="portrait" android:theme="@style/Theme.NoActionBar"/>
                <service android:exported="false" android:name="com.appcelerator.analytics.APSAnalyticsService"/>
                <meta-data android:name="com.google.android.gms.version" android:value="9683000"/>
                <activity
                    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity"/>
            </application>
        </manifest>
    </android>

but when i compile the app the console gave me this error

[ERROR] :  Conflicting jar files detected:
[ERROR] :  
[ERROR] :  The following modules have different "google-play-services-base.jar" files
[ERROR] :     ti.cloudpush       (version 3.4.1) (hash=68b48e0a3cb3582bd4ab0bb00625b83a)
[ERROR] :     ti.android.admob   (version 1.0) (hash=730a1d6196847cb5b1067ac02a875876)
[ERROR] :  
[ERROR] :  You can either select a version of these modules where the conflicting jar file is the same or you
[ERROR] :  can try copying the jar file from one module's "lib" folder to the other module's "lib" folder.

So I removed google-play-services-base.jar from the ti.cloudpush module (I removed also google-play-services-gcm.jar cause a subsequent error). After that the compile works but when the app launched the console log

[ERROR] :  GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
[ERROR] :  TiApplication: (main) [40,5804] Sending event: exception on thread: main msg:java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 9683000 but found 7571000.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />; Titanium 5.5.1,2016/09/27 05:39,b18727f
[ERROR] :  TiApplication: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 9683000 but found 7571000.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
[ERROR] :  TiApplication: 	at com.google.android.gms.common.zze.zzbt(Unknown Source)
[ERROR] :  TiApplication: 	at com.google.android.gms.common.zze.isGooglePlayServicesAvailable(Unknown Source)
[ERROR] :  TiApplication: 	at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
[ERROR] :  TiApplication: 	at com.appcelerator.aps.CCPushService.registerGCM(CCPushService.java:316)
[ERROR] :  TiApplication: 	at com.appcelerator.aps.APSCloudPush$2.onReceived(APSCloudPush.java:1030)
[ERROR] :  TiApplication: 	at com.appcelerator.aps.CCPushService$1.onPostExecute(CCPushService.java:116)
[ERROR] :  TiApplication: 	at com.appcelerator.aps.CCPushService$1.onPostExecute(CCPushService.java:95)
[ERROR] :  TiApplication: 	at android.os.AsyncTask.finish(AsyncTask.java)
[ERROR] :  TiApplication: 	at android.os.AsyncTask.access$500(AsyncTask.java)
[ERROR] :  TiApplication: 	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java)
[ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java)
[ERROR] :  TiApplication: 	at android.os.Looper.loop(Looper.java)
[ERROR] :  TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java)
[ERROR] :  TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
[ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)

You know some incompatibilities with this two module. I launched my app on my LG G3 with Android 6.0 Marshmallow.

What's the matter? I put something wrong in the tiapp.xml?

Thank you,
Alberto

Native ads causes app to crash

Really great module. Good efforts. I'm trying to implement native ads as part of tableview rows. I've copied Native ad sample code from read me with just only one change i.e. reduced height of media view to 150 from 250 but as soon as I scroll tableview to see add the app crashes with following exception:
[ERROR] InputEventReceiver: Exception dispatching input event. [ERROR] TiExceptionHandler: (main) [209,43131] ti.android.admob.AdmobView$2 [ERROR] TiExceptionHandler: [ERROR] TiExceptionHandler: ti.android.admob.AdmobView.createUnifiedNativeAds(AdmobView.java:214) [ERROR] TiExceptionHandler: ti.android.admob.AdmobView.processProperties(AdmobView.java:910) [ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1293) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:508) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:498) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:464) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:515) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:498) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:464) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:515) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:498) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:464) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.forceCreateView(TiViewProxy.java:433) [ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.createControls(TiTableViewRowProxyItem.java:257) [ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:458) [ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:94) [ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:250) [ERROR] TiExceptionHandler: android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220) [ERROR] TiExceptionHandler: android.widget.AbsListView.obtainView(AbsListView.java:2473) [ERROR] TiExceptionHandler: android.widget.ListView.makeAndAddView(ListView.java:1894) [ERROR] TiExceptionHandler: android.widget.ListView.fillDown(ListView.java:710) [ERROR] TiExceptionHandler: android.widget.ListView.fillGap(ListView.java:674) [ERROR] TiExceptionHandler: android.widget.AbsListView.trackMotionScroll(AbsListView.java:5554) [ERROR] TiExceptionHandler: android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3620) [ERROR] TiExceptionHandler: android.widget.AbsListView.onTouchMove(AbsListView.java:4108) [ERROR] TiExceptionHandler: android.widget.AbsListView.onTouchEvent(AbsListView.java:3890) [ERROR] TiExceptionHandler: ti.modules.titanium.ui.widget.listview.TiNestedListView.onTouchEvent(TiNestedListView.java:125) [ERROR] TiExceptionHandler: android.view.View.dispatchTouchEvent(View.java:8527) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2542) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2225) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2548) [ERROR] TiExceptionHandler: android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2239) [ERROR] TiExceptionHandler: and [ERROR] Ads: Fail to get isAdIdFakeForDebugLogging [ERROR] Ads: java.io.IOException: java.util.concurrent.TimeoutException: Timed out waiting for the service connection [ERROR] Ads: at com.google.android.gms.ads.identifier.d.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:42) [ERROR] Ads: at com.google.android.gms.ads.internal.util.c.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:3) [ERROR] Ads: at com.google.android.gms.ads.internal.util.a.run(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:3) [ERROR] Ads: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) [ERROR] Ads: at xw.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:1) [ERROR] Ads: at xh.run(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:7) [ERROR] Ads: at xx.run(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:1) [ERROR] Ads: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) [ERROR] Ads: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) [ERROR] Ads: at java.lang.Thread.run(Thread.java:818) [ERROR] Ads: Caused by: java.util.concurrent.TimeoutException: Timed out waiting for the service connection [ERROR] Ads: at com.google.android.gms.ads.identifier.d.a(:com.google.android.gms.policy_ads_fdr_dynamite@[email protected]:36)

I am getting error when opened windows quickly

@deckameron hi again. I have an error. My app has got multiple windows. I have created common function in my libs folder as below

var Admob = require("ti.android.admob");
exports.FncCreateAdmobInterstitial = function(_QsContainerWindow) {
		
				var AdmobInterstitial = Admob.createView({
					top : 0,
					adSizeType : "INTERSTITIALAD",
					publisherId : "xxxxxxxxxxxxxxxxxxxxxxxx", //> USE YOUR PUBLISHER ID HERE
					testing : false
				});

				_QsContainerWindow.add(AdmobInterstitial);

				AdmobInterstitial.addEventListener('ad_received', function(e) {
					Titanium.API.warn("Interstital Ad Received");
				});

				AdmobInterstitial.addEventListener('ad_not_received', function(e) {
					Titanium.API.error("Interstital Ad failed");
				});

				AdmobInterstitial.addEventListener('ad_ready_to_be_shown', function(e) {
					Titanium.API.warn("Interstital Ad is READY!");
					AdmobInterstitial.showAdNow();

				});

				AdmobInterstitial.addEventListener('ad_not_ready_yet', function(e) {
					Titanium.API.warn("Interstital Ad is not ready yet!");
				});

				AdmobInterstitial.addEventListener('ad_being_shown', function(e) {
					Titanium.API.warn("Interstital Ad being shown right now!");
				});

				AdmobInterstitial.addEventListener('ad_closed', function(e) {
					Titanium.API.warn("Interstital ad close successfully. RIP!");
				});
			});

I am calling above function as below

mylibs.FncCreateAdmobInterstitial($.windowId);

It is working when I wait and do not press android back button quickly. If I press quickly android back button app is crashing.

Do you have any idea?

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

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

  • D3 photo D3

    Data-Driven Documents codes.