android - Admob Interstitial Ad non clickable -
i created android game , issue using both banner ad , interstitial ad 1) banner ad shows while playing game , 2) interstitial ad shows when player ends winning level problem facing admob interstitial ad showing 1 cannot click it, display @ level end user not able click tried searching around couldn't find solution it, please these source usage of ad code in game
the activity file :
public class app extends activity { private interstitialad interstitial; } public static void showinterad(){ ((app)app.ctx).showad(); } // banner ad @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); ctx = this; setvolumecontrolstream(audiomanager.stream_music); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.main); // create ad request. adrequest adrequest = new adrequest.builder().build(); // adview resource , load request. adview adview = (adview)this.findviewbyid(r.id.adview); adview.loadad(adrequest); }// interstitial ad public void showad(){ ((activity)ctx).runonuithread(new runnable() { @override public void run() { // create interstitial. interstitial = new interstitialad(app.this); interstitial.setadunitid("ca-app-pub-id"); adrequest adrequest = new adrequest.builder().build(); interstitial.loadad(adrequest); // set adlistener. interstitial.setadlistener(new adlistener() { @override public void onadloaded() { if (interstitial.isloaded()) { interstitial.show();
i calling ad code in different file :
levelcompleted = true; endofgame = true; soundmanager.playsound(app.sound_won); app.showinterad(); }
the manifest file :
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xyz" android:installlocation="preferexternal" android:versioncode="1" android:versionname="1.0" > <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="true" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_coarse_location" android:required="false" /> <uses-permission android:name="android.permission.access_fine_location" android:required="false" /> <uses-permission android:name="android.permission.access_mock_location" android:required="false" /> <uses-permission android:name="android.permission.access_network_state" android:required="false" /> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.write_settings" /> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/theme.notitlebar"> <activity android:name="com.xyz.app" android:alwaysretaintaskstate="true" android:configchanges="orientation|keyboard" android:label="@string/app_name" android:launchmode="singleinstance" android:screenorientation="portrait" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> <intent-filter> <action android:name="com.xyz.game" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.google.android.gms.ads.adactivity" android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize" /> </application> </manifest>
remove :
android:launchmode="singleinstance"
manifest file.
Comments
Post a Comment