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

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.

Related

Google play leaderboards not updating the score after new score has been reported

I have been struggling with this problem for a few days... I have google play services set up, my achievements work properly, but the leaderboard doesn't seem to want to work.
This is the code that reports new score to the leaderboard:
public static void AddScoreToLeaderboard(string LeaderboardId, long score) {
Social.ReportScore(score, LeaderboardId, success => { Debug.Log("Leaderboard updated: "+score); });
}
When the function is called i get the debug message saying that the leaderboard has been updated but when i go back to the leaderboard which i display with this:
public static void ShowLeaderboardsUI()
{
Social.ShowLeaderboardUI();
}
The leaderboard is completely empty...
Any help will be appreciated.
So another user on github suggested this and it worked for me.
I had same problem with my game but i resolved that.
Follow the steps carefully:
1-Go to https://console.developers.google.com/apis/credentials
2-Remove all credentials
3-Go to https://play.google.com/apps/publish
4-In all applications tab click on your game
5-Then from left menu click on Release Management and then go to App signing
6-Copy the code of SHA1 from the App signing certificate part
7-Go back to https://console.developers.google.com/apis/credentials
8-Create credentials and choose OAuth client ID
9-Choose application type (it was android for me!)
10-paste the code you copied from part 6 in Signing-certificate fingerprint field
11-Write the package name of the game exactly in Package name field the click on create
12-Go back to https://play.google.com/apps/publish
13-click on Game Services and then click on your game
14-Click on Link apps from left menu
15-click on Link another app
16-Choose your platform (android for me!)
17-write a name
18-click on Package name field and choose your package name there
19-save and publish the linked app that you just created
20-compare the OAuth2 Client ID from linked app that you just created with Client ID in credentials you created in part 11
21-if they have the same code the leaderboard will work fine!
Hope it solves your problem!

flutter ad's only display in test mode

I try to implement ad mob package in my flutter app. I have create my admob account, I choose reward ad, I have my Id bloc and my appId, I have add my google-services.json in the app folder,I have completed the manifest.
My problem is when I use
.load(adUnitId: RewardedVideoAd.testAdUnitId, targetingInfo: targetingInfo)
It's OK I can see video ad after press button, but it's not my unitID
If I use my UnitID like that
.load(adUnitId:"ca-app-pub-xxxxxxxxxxxx/xxxxxxxxx", targetingInfo: targetingInfo)
I have no video ad after press button
I have this error
error in showing ad: PlatformException(ad_not_loaded, show failed for rewarded video, no ad was loaded, null)
I have since long time a bug with release mode, so I launch only in debug mode, it can be the source of my problem ?
Are there a delay of use after creation of admob account or bloc ?
thank you
ads show when u publish your app in the store so if the test ads work's fin than your ads work perfact

Which of the MobileAdTargetingInfo properties of Flutter Firebase AdMob package do I need for release?

I want to know when using firebase_admob, do I need this code?
If so, when releasing an app, what should I write for keywords, contentUrl, and testDevices?
I mean, when releasing an app, testDevices is even necessary?
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>[], // Android emulators are considered test devices
);
this information is used to show ad to users.
You should use keywords related to your application. Ex: if Your application is related to hospital then you can use medicine as your key words.
you can add you web site url if you develop any web site for particular application as contentUrl .
testDevices is a Id of you device in which you are tested. if you want to test your application in real device then you must add test device id because it help you to avoid ad mob bane.
MobileAdTargetingInfo class properties mirror the native AdRequest API.
You will find more information about those properties in the documentation for AdRequest.Builder and RequestConfiguration.Builder.
AdRequest.Builder
public AdRequest.Builder addKeyword (String keyword)
Add a keyword for targeting purposes.
public AdRequest.Builder setContentUrl (String contentUrl)
Sets the content URL for a web site whose content matches the app's primary content. This web site content is used for targeting and brand safety purposes.
At the time of writing some parameters from the question have been deprecated with no alternative, some like the one below replaced with a different approach, while some other moved to RequestConfiguration.Builder.
public AdRequest.Builder setIsDesignedForFamilies (boolean isDesignedForFamilies)
Deprecated. Use Ad Content Filtering.
RequestConfiguration.Builder
public RequestConfiguration.Builder setTagForChildDirectedTreatment (int tagForChildDirectedTreatment)
This method allows you to specify whether you would like your app to be treated as child-directed for purposes of the Children’s Online Privacy Protection Act (COPPA)
public RequestConfiguration.Builder setTestDeviceIds (List testDeviceIds)
Sets a list of test device IDs corresponding to test devices which will always request test ads. The test device ID for the current device is logged in logcat when the first ad request is made.

facebook-java-sdk unable to create "Ad", says using instagram a/c as placement when not really using anything

I am trying to create Ad using facebook-java-sdk
val adCreative = new AdAccount(ACCOUNT_ID, context).createAdCreative()
.setName(s"Test Creative +$TEST")
.setObjectStorySpec(
new AdCreativeObjectStorySpec()
.setFieldLinkData(
new AdCreativeLinkData()
.setFieldCaption("http://www.field-caption.com")
.setFieldImageHash(attachment1.getFieldImageHash)
.setFieldLink("http://www.google.co.in")
.setFieldMessage("try it out")
)
.setFieldPageId(FACEBOOK_PAGE)
)
.execute()
val ad = new AdAccount(ACCOUNT_ID, context).createAd()
.setName(s"Test Ad +$TEST")
.setAdsetId(adSet.getId)
.setCreative(adCreative.getId)
.setCreative(new AdCreative().setFieldId(adCreative.getId()))
.setStatus(Ad.EnumStatus.VALUE_PAUSED)
.execute()
However the createAd calls fails and results into exception with
com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_subcode":1772103,"is_transient":false,"error_user_title":"Instagram Account Is Missing","error_user_msg":"You're using Instagram as a placement. Please select an Instagram account to represent your business in your Instagram ads, or select a Facebook Page to use instead.","fbtrace_id":"FtpWRXVY1tH"}}
This was working fine couple of days back, but all of sudden has started throwing an exception. Any help would be appreciated.
I'd like to add to this answer since i just fought with this issue.
Our long running app that managed boosting just stopped working this month and was throwing the error the OP mentioned.
It appears that the default settings on Facebook's side changed. The docs state that the defaults are facebook, audience_network, messenger
Looking in the Ads Manager, it shows that the placement for the failed boost attempt now includes instagram as a placement. There doesn't seem to be any mention of this change anywhere that I could find.
So I did have to change the call to explicitly define facebook, audience_network, messenger as my publisher_platform setting and not rely on the defaults.
You can explicitly specify publisher platform to publish only on facebook
val adSet = new AdAccount(ACCOUNT_ID, context).createAdSet()
.setName(s"Test AdSet +$TEST")
.setLifetimeBudget(20000L)
.setStartTime(currentDateTime.toString())
.setEndTime(currentDateTime.plusDays(1).toString())
.setCampaignId(campaign.getId())
.setIsAutobid(true)
.setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS)
.setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_POST_ENGAGEMENT)
.setTargeting(
new Targeting()
.setFieldCustomAudiences(List(idNameCusAudience).asJava)
.setFieldPublisherPlatforms(List("facebook").asJava)
)
.setStatus(AdSet.EnumStatus.VALUE_PAUSED)
.execute()
None of these answers really answer what you need to do if you want to include Instagram.
In order to post to instagram you need an instagram account ID.
Every single page on Facebook has (or can have) an instagram 'account' without the user creating one.
What you need to do is (in this order):
Check if they have an instagram linked (if they do you use this ID)
Check for page_backed_instagram_accounts to see if their page has an instagram account that Facebook made for them to be able to advertise (this account is hidden and cannot be found on instagram) if they have this, use the ID from this account.
If for some reason their page has no instagram nor does it have page_backed_instagram_accounts then you will need to create a page_backed_instagram_account
The endpoints you are looking for are:
https://graph.facebook.com/v3.1/[pageId]?fields=instagram_accounts
https://graph.facebook.com/v3.1/[pageId]?fields=page_backed_instagram_accounts

InterstitialAd object is there in Admob and Facebook

Background : I am trying to have the Interstitial Ads from Admob and Facebook separately (Not via Mediation) . The facebook Ads will be triggered if the App is installed from Amazon App store.
Question : I need to declare the variable interstitialFromAdmob and interstitialAdFromFacebook. interstitialFromAdmob is for the Ad from Admob and interstitialAdFromFacebook is for the Ad from Facebook. For this Admob and Facebook has used the same Object InterstitialAd. Hence I am unable to declare the variables pointing the Admob and facebook separate. Please let me know how to resolve this
InterstitialAd interstitialFromAdmob;
InterstitialAd interstitialAdFromFacebook;
This is a very common case.
For those classes have duplicated short class name, a long or full path class name shall be used.
For examples, you can use:
com.facebook.ads.InterstitialAd internstitialAdFromFacebook;