我想在我的webview android應用上顯示插頁式廣告,但我無法實現它。如何在webView應用程序中顯示插頁式廣告?
我有一個完全在線的webview應用程序,沒有脫機頁面或任何按鈕或菜單。
我不想在啓動或關閉應用程序時顯示插頁式廣告。
- 當用戶使用該webview應用瀏覽我的網站時應顯示廣告。
- 我認爲在x分鐘後使用插頁式廣告,但是我在x分鐘後學習插頁式廣告不是here和here的好主意。
- 那麼如何告訴我如何在我的應用上顯示插頁式廣告?我沒有任何按鈕或菜單,但只有一個網站可供瀏覽。
- 請教我如何在我的webview應用程序中使用插頁式廣告。
- 我試過併成功實施了BANNER廣告。 (但代碼如下)但無法通過任何方式實施插頁式廣告
- 我在這個領域非常新,所以請建議我詳細說明處理方式,其中放置代碼等
activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.xxxx.yyyyy.MainActivity"
android:layout_gravity="center"
android:id="@+id/fl">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/wv"/>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-xxxxx/xxxxxx">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
使用火力Mainactivity的java
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;
MobileAds.initialize(this, "xxxxxx~xxxxxx");
AdView adView = (AdView)findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("xxxxxxx")
.build();
adView.loadAd(adRequest);
(build.gr adle)
compile 'com.google.firebase:firebase-ads:10.2.6'
我不要認爲插頁式廣告會爲您提供自定義點擊處理機制。但是,如果您想處理用戶點擊,則應查看NativeCustomTemplateAds https://developers.google.com/mobile-ads-sdk/docs/dfp/android/native – Ezio