「Android/広告組込/google/admob/メディエーション/nend」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==追加方法== 公式 https://developers.google.com/admob/android/mediation/nend build.gradle <pre> repositories { maven { url 'http://fan-adn.github.io/ne...」) |
|||
(同じ利用者による、間の6版が非表示) | |||
行13: | 行13: | ||
implementation 'com.google.android.gms:play-services-ads:18.3.0' | implementation 'com.google.android.gms:play-services-ads:18.3.0' | ||
implementation 'com.google.ads.mediation:nend:5.2.0.0' | implementation 'com.google.ads.mediation:nend:5.2.0.0' | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | java | ||
+ | <pre> | ||
+ | import com.google.ads.mediation.nend.NendAdapter; | ||
+ | import com.google.ads.mediation.nend.NendExtrasBundleBuilder; | ||
+ | Bundle bundle = new NendExtrasBundleBuilder().setUserId( | ||
+ | "userId").setInterstitialType(NendAdapter.InterstitialType.TYPE_NORMAL).build(); | ||
+ | AdRequest adRequest = new AdRequest.Builder().addNetworkExtrasBundle( | ||
+ | NendAdapter.class, bundle).build(); | ||
+ | adLoader.loadAd(adRequest); | ||
+ | </pre> | ||
+ | |||
+ | ===確認=== | ||
+ | 以下でgetMediationAdapterClassName()がcom.google.ads.mediation.nend.NendRewardedAdapterであれば成功 | ||
+ | <pre> | ||
+ | private RewardedVideoAd mReward; | ||
+ | mReward = MobileAds.getRewardedVideoAdInstance(this); | ||
+ | mReward.setRewardedVideoAdListener(mListener); | ||
+ | private RewardedVideoAdListener mListener = new RewardedVideoAdListener() { | ||
+ | @Override | ||
+ | public void onRewardedVideoStarted() { | ||
+ | Log.d("reward", mReward.getMediationAdapterClassName()); // com.google.ads.mediation.nend.NendRewardedAdapter | ||
+ | } | ||
} | } | ||
</pre> | </pre> |
2020年1月29日 (水) 18:55時点における最新版
追加方法
公式 https://developers.google.com/admob/android/mediation/nend
build.gradle
repositories { maven { url 'http://fan-adn.github.io/nendSDK-Android-lib/library' } } dependencies { implementation 'com.google.android.gms:play-services-ads:18.3.0' implementation 'com.google.ads.mediation:nend:5.2.0.0' }
java
import com.google.ads.mediation.nend.NendAdapter; import com.google.ads.mediation.nend.NendExtrasBundleBuilder; Bundle bundle = new NendExtrasBundleBuilder().setUserId( "userId").setInterstitialType(NendAdapter.InterstitialType.TYPE_NORMAL).build(); AdRequest adRequest = new AdRequest.Builder().addNetworkExtrasBundle( NendAdapter.class, bundle).build(); adLoader.loadAd(adRequest);
確認
以下でgetMediationAdapterClassName()がcom.google.ads.mediation.nend.NendRewardedAdapterであれば成功
private RewardedVideoAd mReward; mReward = MobileAds.getRewardedVideoAdInstance(this); mReward.setRewardedVideoAdListener(mListener); private RewardedVideoAdListener mListener = new RewardedVideoAdListener() { @Override public void onRewardedVideoStarted() { Log.d("reward", mReward.getMediationAdapterClassName()); // com.google.ads.mediation.nend.NendRewardedAdapter } }