My Libgdx game slow when integrated Admob -
i new game developing libgdx. have problem admob ads. when call "adview.loadad(adrequest);" game slowl, when start game, fps ~ 60 , when call adview.loadad(adrequest) game fps ~ 30.
here
public class mainactivity extends androidapplication implements iactivityrequesthandler { protected adview adview; adrequest adrequest; private final int show_ads = 1; private final int hide_ads = 0; protected handler handler = new handler() { @override public void handlemessage(message msg) { switch (msg.what) { case show_ads: { system.out.println("show adview"); adview.setvisibility(view.visible); break; } case hide_ads: { adview.setvisibility(view.gone); break; } } } }; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // create layout relativelayout layout = new relativelayout(this); // stuff initialize() requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); getwindow().clearflags(windowmanager.layoutparams.flag_force_not_fullscreen); // create libgdx view view gameview = initializeforview(new mygdxgame(this), false); // create , setup admob view`enter code here` adview = new adview(this, adsize.banner, "xxxxxx"); // put in // secret key // here adrequest = new adrequest(); adview.loadad(adrequest); // adview.loadad(new adrequest()); // add libgdx view layout.addview(gameview); // add admob view relativelayout.layoutparams adparams = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); adparams.addrule(relativelayout.align_parent_top); adparams.addrule(relativelayout.align_parent_right); layout.addview(adview, adparams); // hook setcontentview(layout); } // callback posts message handler @override public void showads(boolean show) { handler.sendemptymessage(show ? show_ads : hide_ads); } }
i read topic using interstitials admob in libgdx game android, it's slow when dismissing it
not solution please me if have solution. sory bad english. thanks!
Comments
Post a Comment