facebook twitter hatena line email

Javascript/reactnative/admob/expo

提供: 初心者エンジニアの簡易メモ
2020年7月16日 (木) 15:43時点におけるAdmin (トーク | 投稿記録)による版 (以下エラーが出たとき)

移動: 案内検索

admobプラグインのインストール

$ expo install expo-ads-admob

app.json にandroidとiosを追加

{
  "android": {
    "config": {
      "googleMobileAdsAppId": "ca-app-pub-3940256099942544~3347511713" // sample id, replace with your own
    }
  },
  "ios": {
    "config": {
      "googleMobileAdsAppId": "ca-app-pub-3940256099942544~1458002511" // sample id, replace with your own
    }
  },
}

setTestDeviceIDAsyncのfunctionは存在しないと出たとき

以下エラーが出たとき

[Unhandled promise rejection: TypeError: _expoAdsAdmob.AdMobInterstitial.setTestDeviceIDAsync is not a function.

setTestDeviceIDAsyncでなく、setTestDeviceIDを使う

AdMobInterstitial.setTestDeviceID is deprecated. Test device IDs are now set globally. Use AdMob.setTestDeviceIDAsync instead.

setTestDeviceIDでなく、setTestDeviceIDAsyncを使う

参考

https://honmushi.com/2019/11/28/expo-admob/