Open Nikolak47 opened 4 years ago
I can make the pull request and implement it. Edit : also thinking maybe update the plugin to support the new plugin API used by Flutter >= 1.12
@yiss Yes, do it please :) Also, can you tell me if it shows you ads on your physical device ?
Whats up @yiss and @Nikolak47
I'm sorry I've been busy with my day job. If you have a solid solution for targeting please PR it. I'll be getting back to this project soon. I'm also going to need web support!
Hi @kmcgill88 we totally understand no worries. I'm happy to help
I would love to see this feature implemented. I'm currently using a fork which adds an optional parameter "personalizedAds" to comply with the GDPR.
@davidmartos96 can you link this fork please so that I can take a look at it ?
@yiss Sure, it's https://github.com/js2702/admob_flutter and the branch non_personalized
.
Here is the pull request #164 I added the same AdRequestFactoryBuilder used by the official Flutter admob plugin the modifications work fine I tested it on my mobile device : https://drive.google.com/file/d/1eNftPAGkBXPnX8vRRs1lReMTYj83Vqt-/view
@yiss Can you tell me how to use it ? Here is my implementation, step by step:
@Nikolak47 I use
MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
birthday: DateTime.now(),
childDirected: false,
designedForFamilies: false,
gender:
MobileAdGender.male, // or MobileAdGender.female, MobileAdGender.unknown
testDevices: <String>[
// Add the String showed in this line in the console < Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("AAAAAAAAAAAAAAAAAAAAAAAA") to get test ads on this device. >
// To load ads on test devices
//'AAAAAAAAAAAAAAAAAAAAAAAA'
], // Android emulators are considered test devices
);
And then I use it
interstitialAd = AdmobInterstitial(
adUnitId: getInterstitialAdUnitId(),
targetingInfo: targetingInfo,
listener: (AdmobAdEvent event, Map<String, dynamic> args) {
if (event == AdmobAdEvent.closed) interstitialAd.load();
handleEvent(event, args, 'Interstitial');
},
);
rewardAd = AdmobReward(
adUnitId: getRewardBasedVideoAdUnitId(),
targetingInfo: targetingInfo,
listener: (AdmobAdEvent event, Map<String, dynamic> args) {
if (event == AdmobAdEvent.closed) rewardAd.load();
handleEvent(event, args, 'Reward');
});
And for the Banner :
dmobBanner(
targetingInfo: targetingInfo,
adUnitId: getBannerAdUnitId(),
adSize: bannerSize,
listener:
(AdmobAdEvent event, Map<String, dynamic> args) {
handleEvent(event, args, 'Banner');
},
),
I forgot to update the main.dart in example I just did :) cheers
Normally if it's working properly it should print I/Ads (30315): This request is sent from a test device.
in the console
@Nikolak47 let me know if that worked for you
@yiss Thanks for the example. It works with banners, but I still can't make it work with interstitial ads...
@Nikolak47 are you using your version or mine? Because in yours you haven't implemented targetingInfo for interstitial. I did it for the interstitial and reward ad you can check it on my github : https://github.com/yiss/admob_flutter the last commit is what you need. Waiting for the PR to be merged
I'm using your version...
@Nikolak47 weird, can you show me the console output? Does it say anything?
I think the problem with not showing interstitial Ads on the test device is 'Error: 3' (selected in red), because earlier when I was trying to load interstitial ad, it threw this error. Also, after implementing this package, I started getting the getStreamVolume isRestricted mode = 0 (selected in blue).
@Nikolak47 Erro 3 means that the request was successful but there is no Ad to serve this can be caused by many reasons. Can you test your interstitial with the one here : https://developers.google.com/admob/android/test-ads
@yiss Thank you very much, it works! There is probably a problem with the interstitial Ad I defined in my admob account. Thanks again! :)
Alright! That's good news to hear. Glad I can help
Hi, does this include the non-personalized? and which package and branch do I need or waiting the PR here? thanks
@cyberlahy yes by default it's non personalised, I made a PR waiting for it to be merged. You can check out my fork it contains the proper working version
@yiss I see your code and I think it's by default "personalized" and we need to precise if it is not. Or I am wrong?
@cyberlahy by the default targetingInfo is not required, when specify targetingInfo property you're then doing a personalized ads, example : If you do targetingInfo: MobileAdTargetingInfo() without specifying any targeting info it's not personalized, if you add something like gender, date... Then it becomes personalized ads. You can check here :https://support.google.com/admob/answer/7676680?hl=en
Hey! I just added targetingInfo (from the guy who failed to merge) to the newest state of the package. Too lazy to make a pull request, so I'll just upload the zip file, for someone to do it. Package (WeTransfer link): https://we.tl/t-SfTm7GqAmu
If you find any problems/bugs, message me. Will be glad if this is added to the newest version. As file: admob_flutter-withTargetingInfo.zip