Admob test device registration

 

1. Make a service:

 

class AdvertisingService {
//generic test ID from https://developers.google.com/admob/android/native/start?hl=en-US
String testAdId = 'ca-app-pub-3940256099942544/2247696110';
String myProjectNativeAdId() {
if (isInDebugMode) {
return testAdId;
}
return 'yourAdIdHere';
}
bool get isInDebugMode {
bool inDebugMode = false;
assert(inDebugMode = true);
return inDebugMode;
}
}

 

2. wherever you're calling the ad, use:

 

AdvertisingService advertisingService = AdvertisingService();
NativeAdmob(
adUnitID: advertisingService
.myProjectNativeAdId(),
...
)

'플러터(Flutter) > 플러터 패키지(Flutter Package)' 카테고리의 다른 글

Flutter local notification  (0) 2020.03.19
geolocator  (0) 2020.03.19
audio player  (0) 2020.03.18
Dart Package  (0) 2020.03.18

+ Recent posts