facebook twitter hatena line email

Android/広告組込/google/admob/基本

提供: 初心者エンジニアの簡易メモ
2020年9月17日 (木) 15:30時点におけるAdmin (トーク | 投稿記録)による版 (テストデバイスID)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

ポリシー違反警告

以下のようなポリシー違反警告がくる場合

This email is to alert you that your app is currently in violation of the AdMob program policies. Importantly, this will require action on your part to ensure no disruption in ad serving. Please read below for more information on the actions you need to take. View in policy center

自分のアプリの場合は、バナー広告の上にリワード広告が被っていたので、修正した。

問題なければ以下のようなメッセージが来る

Regarding your Google AdMob Policy Violation Review
We’ve completed reviewing your app and no policy violations were found.

テストデバイスID

広告表示時に以下ログが出るので、そこに記載のidを入れる。

List<String> testDeviceIds = Arrays.asList("E36A38A1F26D812D88FB97BF7D71234");
RequestConfiguration configuration =
    new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();
MobileAds.setRequestConfiguration(configuration);

もしくは、以下を入れると良いかも。

String androidId =  Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
Log.i(TAG, "testDeviceId=" + md5(androidId).toUpperCase()); // E36A38A1F26D812D88FB97BF7D71234

md5のロジックは Android/hash/md5 [ショートカット]

生成したidとコンソールに出るtestDeviceIdは、一致したので使える。

参考:https://www.it-swarm.dev/ja/android/admob%E3%81%AE%E3%83%87%E3%83%90%E3%82%A4%E3%82%B9id%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/970162780/

以下の様なaddTestDeviceはv.19ぐらいからで非推奨となった。

new AdRequest.Builder()
                        .addTestDevice("E36A38A1F26D812D88FB97BF12341234")
                        .build());

androidの最小APIについて

admobプラグインのminimumについて 2020‑03‑02からでてるv.19.0.0 でAPI 16となる。

https://developers.google.com/admob/android/rel-notes

This release is a MAJOR version update with the following breaking changes:
Updated minimum Android SDK version to API 16 to align with the Google Play services distribution policy.
Native Ads: Moved MediaContent to the com.google.android.gms.ads package.

google-play-servicesについても2018/12/6にはAPI14,15について更新が停止されてます。 https://android-developers.googleblog.com/2018/12/google-play-services-discontinuing.html

他アドネットワークも最小APIは16 https://developers.google.com/admob/unity/mediate?hl=ja

nend 16
tapjoy 16
unityads 16
vungle 16
AdColony 16
AppLovin 16
facdbook 16
ironsource 16
maio 16
mopub 16

onAdFailedToLoadの非推奨対応

admob-19.0.0?から非推奨?

修正前

mAdView.setAdListener(new AdListener() {
    @Override
    public void onAdFailedToLoad(int error) {
        // Code to be executed when an ad request fails.
    }
}

修正後

mAdView.setAdListener(new AdListener() {
    @Override
    public void onAdFailedToLoad(LoadAdError adError) {
        // Code to be executed when an ad request fails.
    }
}