kmcgill88 / admob_flutter

Admob Flutter plugin that shows banner ads using native platform views.
https://pub.dartlang.org/packages/admob_flutter
ISC License
434 stars 151 forks source link

How do I invoke Admob.requestTrackingAuthorization() #280

Open mnc12004 opened 3 years ago

mnc12004 commented 3 years ago

HI, I guess this is not particularly an issue with the package, but I can't find the answer anywhere.

I am trying to invoke Admob.requestTrackingAuthorization() to satisfy Apples approval process and I have tried a few different approaches.

I wrapped in a function and call the function within the Builder widget: static Future checkPermissions() async { if (Platform.isIOS) { // Run this before displaying any ad. print('IOS Detected'); await Admob.requestTrackingAuthorization(); // return Admob.requestTrackingAuthorization(); //this didn't work either } else if (Platform.isAndroid) { print('Android Operating System Detected'); } }

I'm getting the print object but not getting a dialog on iOS.

I have tried this in main.dart, home_page.dart and now have it checked before any ad loads.

I'm not sure if Apple will accept the build if I just remove the tracking key and information...

Any help is greatly appreciated.

j-j-gajjar commented 3 years ago

any solution?