Admob plugin making ionic non responsive


#1

i did put up one issue here but got no answer

As i said in the previous issue i do not have any other code than the admob code and the ads are loading and the app is loading as well but when i click on anything in my app there is a 40 second delay(yeah i measured it with a stop watch).

here is the code for my app .js file

   angular.module('starter', ['ionic', 'starter.controllers'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
//this is the added admob code
     if ( window.plugins && window.plugins.AdMob ) {
   var admob_key= device.platform=="Android" ? "ca-app-pub-8440343014846849/3119840614" : "ios banner key goes here";
 
 var admobObj=window.plugins.AdMob;
    admobObj.createBannerView({
       'publisherId': admob_key,
       'adSize':admobObj.AD_SIZE_BANNER,
       'bannerAtTop': false,
       'autoShow': true 
    },function(){
      admobObj.requestAd(
        {
          'isTesting':false
        },
        function(){
          admobObj.showAd(true);
        },function(){
          alert("failed");1
        });
    },
    function(){
      alert("failed for banner view");
    }
    );
    }
  });
})

kindly solve this as soon as possible

I am using android 4.1


#2

Hmm, have you tried this on any other device?
The code looks right, so it may be a limitation of that particular device.

@nicraboy, you’ve used admob more than I have, what can @prantikv expect for a performance hit?


#3

Yea @prantikv sent me a message on pretty much every one of my accounts regarding this.

He mentioned that he is using Android 4.1 on a device which may or may not have good specs. I only test on 4.4.4+ and I experience no performance issues. Because of this, I suggested he try to install Crosswalk into his project.

Still pending a response from him:

Regards,


#4

I don’t see any such issues in Android 4.4.4 device. But in Android 5, the device itself is slow and every application has performance issues. Response time in my Moto G is pretty bad after the L update.


#5

I think the Moto G is a low spec device to begin with and probably shouldn’t have 5.0. That is like trying to put Windows 8 on a computer from 6 years ago. Might work, but not well.


#6

I don’t agree @nicraboy. Moto G is not really a low spec device. It’s a decent one. May be Android 5 made it bad :smiley:

BTW, I am a big fan of your blog articles.


#7

i have used it on andord 4.1 and 4.2 devices…removing the admob code makes the app run just fine…i have also tried and added a lot of complexity to the app and the app just runs fine without admob.

But as soon as the admob code is inserted as i said the 40 second lag is seen on any click…

so i started a new tabs and side-menu ionic project and added just the admob code and still got the lag…

Device specs are Lenovo A7-50 with the MediaTek MTK8382M quad core chipset clocked at 1.3GHz and 1gb ram.

so basically admob works good on its own…ionic works good on its own but when the two combine i get lag…


#8

hey mike …i check it up with crosswalk and a few other devices running 4.1…turns out it is a device specific issue…oddly enough both of my devices running 4.1 and 4.2 had the same problem so i thought problem was somewhere else…but its solved now…

Thanks a lot…


#9

I am experiencing same issues, i am using admobpro however. I have an Asus Zenfone 2 running 5.0, when application tries to prepare an Interstitial ad makes the device completely non responsive(sometimes 2 sec, sometimes up to 10sec). @nicraboy So i don’t think it is about the spec of phone. I am not a experienced developper, but i think something is not right.


#10

I am experiencing the same problem with Android 4.2.2 and an 4 years old Sony XPeria phone.
Did anybody found a solution for this?


#11

another problem is when I update my node.js to new version(version 6.0) crosswalk is not working or giving errors… any solution for that?