firebase
                                
                                 firebase copied to clipboard
                                
                                    firebase copied to clipboard
                            
                            
                            
                        [Android] things disapear after showing a interstitial ad
After closing an interstitial ad some of the buttons and elements in the app disapear.
Loading the ad and events work correctly:
this.ad.onAdEvent((event, error, data) => { switch (event) { case AdEventType.LOADED: console.log('ad loaded'); this.ad.show(); break; case AdEventType.CLOSED: this.routerExtensions.navigate(['postcard-viewer', Constants.Modules.PostCardEditor.result]); break; case AdEventType.OPENED: break; case AdEventType.IMPRESSION: break; case AdEventType.FAILED_TO_SHOW_FULL_SCREEN_CONTENT: console.error('InterstitialAd failed to load:', error); this.routerExtensions.navigate(['postcard-viewer', Constants.Modules.PostCardEditor.result]); break; } }); this.ad.load();
Showing the ad also works correctly.
Once the ad is closed, some buttons and elements are not shown anymore for example:
<Button *ngIf="stateService.freeCard && !loadingQuota && quotaAvailable" [isEnabled]="!showspinner" class="pcc-dark-button send-button" [text]="'viewer.backside.free-send' | translate" actionKey="SEND" (tap)="onSendClick()"> </Button>
Is the state of the elements dependant on the ad ?
Is the state of the elements dependant on the ad ?
No, nothing. The exact same code will display the button correctly without the interstitial video. It's like the video messes up something, but can't figure out what. All state variables are correct and the same with/without showing the ad.
The ad.show is called from within an async method. This is the logic, I load the add in the contructor, then when the user clicks on a send button it should execute the send logic, then show the ad.
Send button logic
this.cardService.uploads(this.textImage, null, null, this.senderAddress, [this.receiverAddress], this.image, this.stamp, eventTrackerBuilder).then(() => { this.userService.getQuota().then(quota => { this.userSettingsService.setLastFreeCardSentDate(moment(quota.next).toDate(), this.userService.getCurrentUser()?.uniqueIdentifier); }); // TODO showing interstitial ad breaks the app! if (this.adReady) { this.ad.show(adShowOptions); } else { this.routerExtensions.navigate(['postcard-viewer', Constants.Modules.PostCardEditor.result]); } }).catch(error => { Dialogs.alert({ title: this.translateService.instant('common.error'), message: this.errorHandlerService.generateUserErrorMessage(error), okButtonText: this.translateService.instant('ok') }); }).finally(() => { this.hideSpinnerDialog(); });
In the constructor onAdEvent I also added the redirect after the video is closed:
case AdEventType.CLOSED: this.routerExtensions.navigate(['postcard-viewer', Constants.Modules.PostCardEditor.result]); break;
Logically everything works correctly, the video is shown, the app redirects after closing the video. It's just that after that some buttons and other elements are not displayed anymore.
Which platform is this running on ?
Never mind just saw it in the title is this using 8.3 ?
Never mind just saw it in the title is this using 8.3 ?
8.2.3
Have you tried wrapping the navigate in a timeout?
Yes, the navigate works correctly, it's just that after that some buttons disapear. For now I have not enabled interstitial ads as I feel it will be hard to find out what is wrong. Maybe later I'll try to start with an empty project and add the dependencies until I see what is the cause. Right now I am focusing on https://github.com/NativeScript/firebase/issues/116 because it's very important that my banner ads show on ios.