我正在使用 Admob原生广告。从下面的代码中,我已经成功完成了AppInstallAd。但是,现在我想在点击广告时打开Play商店或需要 Ad 的Play商店链接。使用Admob原生广告可以做到这一点吗?下面是我的代码:
String adId = "ca-app-pub-3940256099942544/2247696110";
// Test : "ca-app-pub-3940256099942544/2247696110"
final AdLoader adLoader = new AdLoader.Builder(AdActivity.this, adId)
.forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
@Override
public void onAppInstallAdLoaded(final NativeAppInstallAd appInstallAd) {
// Show the app install ad.
Log.d("Ads", appInstallAd + "");
if (appInstallAd.getImages().size() > 0){
adView.setImageDrawable(appInstallAd.getImages().get(0).getDrawable());
}
}
})
.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
@Override
public void onContentAdLoaded(NativeContentAd contentAd) {
// Show the content ad.
Log.d("Ads", contentAd + "");
}
})
.withAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
// Handle the failure by logging, altering the UI, and so on.
Log.d("Ads", errorCode + "");
}
})
.withNativeAdOptions(new NativeAdOptions.Builder()
// Methods in the NativeAdOptions.Builder class can be
// used here to specify individual options settings.
.build())
.build();
adLoader.loadAd(new AdRequest.Builder().build());
}