Skip to content

[Android] things disapear after showing a interstitial ad #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
maxximee opened this issue Aug 1, 2022 · 7 comments
Open

[Android] things disapear after showing a interstitial ad #108

maxximee opened this issue Aug 1, 2022 · 7 comments

Comments

@maxximee
Copy link

maxximee commented Aug 1, 2022

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>

@triniwiz
Copy link
Member

triniwiz commented Aug 1, 2022

Is the state of the elements dependant on the ad ?

@maxximee
Copy link
Author

maxximee commented Aug 1, 2022

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.

@triniwiz
Copy link
Member

triniwiz commented Aug 1, 2022

Which platform is this running on ?

@triniwiz
Copy link
Member

triniwiz commented Aug 1, 2022

Never mind just saw it in the title is this using 8.3 ?

@maxximee
Copy link
Author

maxximee commented Aug 1, 2022

Never mind just saw it in the title is this using 8.3 ?

8.2.3

@triniwiz
Copy link
Member

Have you tried wrapping the navigate in a timeout?

@maxximee
Copy link
Author

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 #116 because it's very important that my banner ads show on ios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants