-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
What package does this bug report belong to?
interactive_media_ads
What target platforms are you seeing this bug on?
Android
Have you already upgraded your packages?
Yes
Dependency versions
pubspec.lock
[Paste file content here]
Steps to reproduce
Try to create non-primitive app with more than 1 screen and with a single reused AdsLoader instance.
Expected results
The requirement of a single reused AdsLoader instance should not be impossible to satisfy outside of a primitive single screen example.
Actual results
I have a simple use case.
An app consists of screens A and B with B screen having a number of pages with videos. Some of videos on the screen B should play IMA content.
Now I have difficulty to understand how to fulfill the following requirement, stated in the API docs:
AdsLoader: Requests ads and handles events from ads request responses. You should only instantiate one ads loader, which can be reused throughout the life of the application.
Observing the example code, example repository and the package source code source code itself it becomes apparent that it is impossible to create AdsLoader without adding AdDisplayContainer to the native View hierarchy.
This means that AdsLoader is tihghtly coupled with a specific AdDisplayContainer on the screen currently. Which means once the AdDisplayContainer will be removed from the widget tree the AdsLoader will become invalid, right?
And, using the provided example in documentation, this means that AdsLoader will be created again every time the AdDisplayContainer added to the widget tree again, right?
So in my case, I don't see any way to create the AdsLoader instance on the screen A. Neither I do see how to keep the same AdsLoader instance on the screen B when pages with IMA content will be entering and leaving the screen adding and removing (creating and destroying) AdDisplayContainer from the widget tree every time.
How am I suppose to fulfill the requirement of reusing a single instance of AdsLoader throughout the life of the application?
Code sample
Code sample
I need one, that follows the stated requirement and demonstrates how IMA content widget can be added and removed from the widget tree.Screenshots or Videos
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
No logs can help hereFlutter Doctor output
Doctor output
It's not important