DelphiWorlds / Kastri

Cross-platform library for Delphi
MIT License
490 stars 118 forks source link

Admob InterstitialAd and banner not show on adnroid 12 #120

Closed barnisoft closed 1 year ago

barnisoft commented 2 years ago

Hi there, i did try use the admob adds banner and interstitialad! If i use only banner, then work is good, but if i use both two the banner and interstitial, then not show the banner and not work interstitial on andorid 12! On andorid 10 and 11 good work! What be the problem? I work with delphi 11.2! Thank you so mutch your help and your time!

DelphiWorlds commented 2 years ago

Is this from the demo, or in your own app?

barnisoft commented 2 years ago

Is this from my app! The demo i can't didn't try, because I want to compiller i get an error! When i try my app on android 10-11, then everything good work, just only on andoird 12 not work nothing, banner and interstitial! If i use only banner, then good work on andorid 12 too.

DelphiWorlds commented 2 years ago

I can only help if I know if you have your app configured correctly. Adding screenshots will not help

barnisoft commented 2 years ago

The first two image about andorid 10, the other image about android 12!

DelphiWorlds commented 2 years ago

Screenshots will not help - you need to show that you have configured your application correctly. Check the demo readme, and the demo project configuration. It works on Android 12

barnisoft commented 2 years ago

Yes, I'm so sorry! So, I added to my project, the "Api, Controls, Core, Futures/AdMob, Futures/SpeechRecognition, Include" dirs and i added in the project libraries the "dw-admob.jar, and i added in the manifest.xml the meta data, my admob Application ID.

<%application-meta-data%> <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxx"/> <%uses-libraries%>

constructor TForm1.Create(AOwner: TComponent); begin inherited; FIntAd := TInterstitialAd.Create; FIntAd.TestMode := False; FIntAd.AdUnitId:='ca-app-pub-xxxxxxxxxxx'; //this ID at interstitial. FIntAd.OnAdDismissedFullScreenContent := AdDismissedFullScreenContentHandler; FIntAd.OnAdFailedToShowFullScreenContent := AdFailedToShowFullScreenContentHandler; FIntAd.OnAdWillPresentFullScreenContent := AdWillPresentFullScreenContentHandler; FIntAd.OnAdLoaded := AdLoadedHander; FIntAd.OnAdFailedToLoad := AdFailedToLoadHandler;

FRewAd := TRewardedAd.Create; FRewAd.TestMode := True; FRewAd.OnAdDismissedFullScreenContent := AdDismissedFullScreenContentHandler; FRewAd.OnAdFailedToShowFullScreenContent := AdFailedToShowFullScreenContentHandler; FRewAd.OnAdWillPresentFullScreenContent := AdWillPresentFullScreenContentHandler; // RewardAds only FRewAd.OnUserEarnedReward := UserEarnedRewardHandler;

// FOpenAd := TAppOpenAd.Create; // FOpenAd.TestMode := True; // FOpenAd.OnAdDismissedFullScreenContent := AdDismissedFullScreenContentHandler; // FOpenAd.OnAdFailedToShowFullScreenContent := AdFailedToShowFullScreenContentHandler; // FOpenAd.OnAdWillPresentFullScreenContent := AdWillPresentFullScreenContentHandler; // FOpenAd.Load;

FSpeech := TSpeechRecognition.Create; FSpeech.StopInterval := 1500; FSpeech.OnAuthorizationStatus := SpeechAuthorizationHandler; FSpeech.OnRecording := SpeechRecordingHandler; FSpeech.OnStopped := SpeechStoppedHandler; FSpeech.OnText := SpeechTextHandler; // FSpeech.Language := 'es-MX'; // For example, if you are expecting Spanish (Mexican) DoStopped; end;

procedure TForm1.OnShow(Sender: TObject); begin AdMobBannerAd1.UnitId:= 'ca-app-pub-xxxxxxxxxxx'; // this other ID at banner // AdMobBannerAd1.AdSize := TAdMobBannerAdSize.Adaptive; AdMobBannerAd1.LoadAd; end;

barnisoft commented 2 years ago

could be the problem that, I right now change the delphi 11.1 about delphi 11.2, but i did only uninstall the delphi 11.1, and install delphi 11.2 and maybe stayed some file from delphi 11.1? Because, if i use the FMX.PhoneDialer too then my app not running on the android 12 i get only black screen!?

DelphiWorlds commented 2 years ago

Your problem is with PhoneDialer, not AdMob - please see this bug report: https://quality.embarcadero.com/browse/RSP-39445

barnisoft commented 1 year ago

No, I have problem with AdMob, and I now test and have a problem API 32! The interstitial ads not work with API 32!

DelphiWorlds commented 1 year ago

"not work" is too vague - please be more specific, e.g. does the application start, or is it stuck on the splash screen again? If the app starts, does the Banner ad work, but not the Interstitial? Does the Reward ad work? Are you launching via the IDE, and if so, does it raise any errors? Give exact details

It may help to use a logcat viewer such as Device Lens to check messages for any clues as to what is going wrong.

barnisoft commented 1 year ago

Alright, I will try tomorrow with Device Lens, and after i will write! Thank you so much!

barnisoft commented 1 year ago

Hi, I did now check it with Device Lens, and i did take pictures! Not runing banner and interstitial too android 12! I use Delphi 11.2! 20221026_224354 20221026_224338 20221026_224557

DelphiWorlds commented 1 year ago

See this link regarding AdMob error code 3: https://support.google.com/admob/thread/134289592/error-code-3-no-ad-config-on-android?hl=en

DelphiWorlds commented 1 year ago

Incidentally, when this error occurs, the Kastri Admob code will call the OnAdFailedToShowFullScreenContent event (for full screen ads, like Interstitial), which you can use to determine what the error is.

barnisoft commented 1 year ago

Thank you your help! I will see this 😊

barnisoft commented 1 year ago

I did have was the problem, until i not upload the new version on google play! Aftert I uploaded on google play, and everything good work! I want to other ask! How to check it when someone closed the interstitial ad or reward ad? Because I want to do something when someone closed the interstitial or rewards ad! Can you help me please? Thank you so much!

DelphiWorlds commented 1 year ago

How to check it when someone closed the interstitial ad or reward ad?

Both of these have an event: OnAdDismissedFullScreenContent, which happens when the user closes the ad. See here, and here in the demo. Also, TRewardedAd has an event: OnUserEarnedReward which provides Amount and RewardType information.

barnisoft commented 1 year ago

thank you so much your time and help! thank you so much everithing!😊😇