Flutter AdMob: how do I track Interstitial Ad payment amount? - flutter

I am implementing AdMob into my Flutter application, and I have interstitial ads showing up correctly in Test Mode. I would now like to determine how much money a particular ad has made, and that doesn't seem to be working.
The solution I have tried to make that happen is using the onPaidEvent function (please let me know if this is incorrect), so in the onAdLoaded function, I currently have the following code:
ad.onPaidEvent = (Ad ad, double valueMicros, PrecisionType precision, String currencyCode) {
double cents = valueMicros * 10000;
print(cents);
} as OnPaidEventCallback;
When I include this code, the app never gets to the call to InterstitialAd.load, but without it, it gets past the InterstitialAd.load and displays the ad properly (on both Android and iOS).
What am I doing wrong?

The issue was not actually with the callback, but rather my own code: I was using the posted code snippet inside of a class that was also called Ad, which was ambiguous and therefore causing casting problems.

Related

Avatars grabbed by discord.py bot not loading on mobile

In every command and embed that i have that uses the avatar_url, the image is not loading on iphone. This includes thumbnails and icons of embeds as well as just the embed image. I have no idea what it is and I've been told that it's a discord issue and that it cannot be fixed but I came here just in case. I asked a few friends on iphone if it was working for them either and it wasn't so it's not just me that my bot's images aren't loading for but it works perfectly on desktop.
Here's my profile picture command code for enlarging profile pictures in case it's something in the code that i'm just not seeing that could affect it in anyway idk.
async def pfp(ctx, member : discord.Member = None):
" :Shows targeted user's avatar/profile picture."
member = ctx.author if not member else member
embed = discord.Embed(
title = f"**{member.name}'s Profile Picture**",
color = discord.Color.green()
)
embed.set_image(url='{}'.format(member.avatar_url))
await ctx.send(embed=embed)```
I had the same issue except in discord.js - try avatar_url() - it fixed mine.
Slightly different syntax so apologies if this is incorrect

Admob unitid not workigng with reactnative but test unit id does work?

I am facing a weired situation where i have implemented a googleadmob in react native app.
<AdMobBanner
bannerSize="fullBanner"
adUnitID="ca-app-pub-3940256099942544/6300978111"
testDeviceID="EMULATOR"
didFailToReceiveAdWithError={this.bannerError} />
where ca-app-pub-3940256099942544/6300978111 is the test id provided by googleadmob
but when i created new Adunit ID and replaced test id with the newly created ad unit id i am unable to any ads Why ??
Note : i am working on dev environment i guess it won't affect but still ..
Try to remove testDeviceID="EMULATOR" when you run on real device.
Sometimes AdMob may take some times to active the ad unit, please ref to: How long does it take for an AdMob Ad unit ID to become active?
One more point, did you input your payment info on AdMob website, AdMob needs your info to serve your ads.

AdMob rewarded video ad in Swift

I'm looking at adding a rewarded video ad to my app that is written entirely in swift. I believe the setup of the web side of things is correct because when I downloaded the Objective C example app and put in my ad id the video showed up correctly. However, when running the same setup in Swift I get returned
Error Domain=com.google.ads Code=1 "Request Error: No ad to show." UserInfo={NSLocalizedDescription=Request Error: No ad to show., NSLocalizedFailureReason=Request Error: No ad to show.}
I've only had ONE time where it actually returned a video. I'm using Chartboost.
Another interesting point is that if I used chart boost directly it seemed to work.
Also, banners work perfectly fine through AdMob in the same app.
Request I Make
let request = GADRequest()
request.testDevices = [ kGADSimulatorID ]
GADRewardBasedVideoAd.sharedInstance().loadRequest(request, withAdUnitID: "AdUnitID")

android facebook login button does not work

I'm following this tutorial "Facebook Login Flow for Android" (https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/) to create a simple app containing only one facebook login button to test facebook login.
However, I've been having trouble logging in facebook with this button.... I've been following every step in this tutorial and I've double checked everything -- it is exactly the same as in this tutorial. I see other people who have similar problems are always because of incorrect debug hash code. But I've checked like a million times that I got the correct debug hash code. Some people say that if you wanna release an app, you need a release code. However, I'm not releasing my app -- I'm just testing it on an android device, so I guess I dont really need a release code to do that?
Also, I've checked that I've included my facebook application id for this app in the Android Manifest. So basically, everything I did was strictly following the tutorials on Facebook Developers.
I've seen some people suggesting to use the "keytool" in JDK 6 in stead of JDK 7. And I've checked that I actually did generate my debug hash code with the "keytool" in JDK 6.
So I've tried everything, but the problem still exists!
In that Android Tutorial, it suggests putting this in your code so that you can monitor your LogCat to see if your current state is logged in or logged out:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
In my case, no matter how many times I clicked Facebook Login Button, I always got "Logged out..." in my LogCat.
Also, the funny thing is, I can't even log in facebook using those sample apps coming with Facebook Android SDK 3.0.1 (eg. SessonLoginSample)!!!!! When I click the login button in those sample apps, nothing happens -- which means I'm not successfully logged in.
I really hope you guys out there can help me with this problem. It's weird I don't see other people with the exact same problem (as I said, those with similar problems are always because of incorrect debug code, but I've checked mine, it is 100% correct). THANK YOU SO MUCH!
It happened to me once. You might have added the export key hash in facebook developer setting.
Add these lines to your code to get your debugging key hash and then add to facebook.
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}

Chartboost in iphone project / Chartboost usage in iOS

Integrated chartoost sdk in to iPhone game. (Landscape game)
#define CHARTBOOST_ID #"55c9f216f6cd4572f3975566"
#define CHARTBOOST_SIG #"9cc8122cfb05bfe0e171f46990180147e8b6f23c"
[Chartboost startWithAppId:CHARTBOOST_ID appSignature:CHARTBOOST_SIG delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
But it is not displaying any ads. Help me to find what's wrong with settings in Xcode or account in chart boost.
Notes_Warning :
Hi All, don't use Chartboost, instead try google Admob or other ads network. Because Chartboost - a cheater! I used Chartboost in my games, game got good ranking in Cambodia - reached #1 in Racing/games. Game got good downloads too...But Chartboost said we used many device in Cambodia and downloaded game...its not true...we are not from Cambodia...I tried to send message to Chartboost many times...but they didn't respond and suspended my account. They even didn't pay my 7463$. Really its a heart attack for us. Now we removed Chartboost and used Admob and earned our development cost from Admob easily. So avoid Chartboost avoid getting cheated!!! Truth always wins...Always do good.
Be a good person but don't try to prove it. Just go away from bad cheaters!!!!
Notes_Warning :
Hi All, don't use Chartboost, instead try google Admob or other ads network. Because Chartboost - a cheater! I used Chartboost in my games, game got good ranking in Cambodia - reached #1 in Racing/games. Game got good downloads too...But Chartboost said we used many device in Cambodia and downloaded game...its not true...we are not from Cambodia...I tried to send message to Chartboost many times...but they didn't respond and suspended my account. They even didn't pay my 7463$. Really its a heart attack for us. Now we removed Chartboost and used Admob and earned our development cost from Admob easily. So avoid Chartboost avoid getting cheated!!! Truth always wins...Always do good. Be a good person but don't try to prove it. Just go away from bad cheaters!!!!
Now its working fine. We need to add publishing campaign in our chartboost account. Here
UPDATES:
[Chartboost startWithAppId:CHARTBOOST_APP_ID appSignature:CHARTBOOST_APP_SIGNATURE delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
Some other way to see test Ads:
Add your device UDID in publishing campaign
Enable test mode in App settings.
Perhaps there has been an error in loading them. I would implement the delegate methods as described in the docs, particularly the didFail method:
// Called before requesting an interstitial from the back-end
- (BOOL)shouldRequestInterstitial:(NSString *)location;
// Called when an interstitial has been received, before it is presented on screen
// Return NO if showing an interstitial is currently inappropriate, for example if the user has entered the main game mode
- (BOOL)shouldDisplayInterstitial:(NSString *)location;
// Called when the user dismisses the interstitial
- (void)didDismissInterstitial:(NSString *)location;
// Same as above, but only called when dismissed for a close
- (void)didCloseInterstitial:(NSString *)location;
// Same as above, but only called when dismissed for a click
- (void)didClickInterstitial:(NSString *)location;
// Called when an interstitial has failed to come back from the server
// This may be due to network connection or that no interstitial is available for that user
- (void)didFailToLoadInterstitial:(NSString *)location;
It may also be because the Campaign is not filling adverts and you have not added the devices as test devices to force the adverts to be filled.
This is easily missed since at first adverts may be filled - only during testing they'll just stop mysteriously.
There is a setting in Chartboost:
Edit the Campaign you are using for testing
Under "Campaign Logic" click the "Show Test Devices" button.
Click "Add Test Device" to add each device.
Enable each device and Save the Campaign.
(Don't forget to un-tick them when live - since I assume that missing that will mean those devices keep seeing adverts but you probably want to see how the app really behaves)
You need to set
cb.delegate = self;