Skip to content
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

Why does the MaxInterstitialAd object require an activity parameter? #639

Closed
omeratesss opened this issue Mar 21, 2024 · 6 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@omeratesss
Copy link

omeratesss commented Mar 21, 2024

Feature Description

I want to load Interstitial ads without opening an Activity. Therefore, the activity parameter is not needed. When I will show an Interstitial ad, the activity parameter is needed.
Note: It requires an activity parameter for the MaxInterstitialAd object. But it is cast to context within Applovin SDK. You can see it below. Why does this situation exist? Why can't I give a context parameter to the MaxInterstitialAd object?

Ekran Resmi 2024-03-21 10 57 59

Ekran Resmi 2024-03-21 10 55 38

@omeratesss omeratesss added the enhancement New feature or request label Mar 21, 2024
@thomasmso thomasmso self-assigned this Mar 21, 2024
@thomasmso
Copy link
Member

Hey @omeratesss - we actually had a few other inquiries with regards to these APIs. Last time we looked at it a few years ago, having an active Activity and passing that through to some mediated SDKs were a requirement. Things might have changed in 2024. We'll investigate next week and update this thread.

@omeratesss
Copy link
Author

Hi @thomasmso , is there any progress? I am waiting for you.

@thomasmso
Copy link
Member

@omeratesss - I looked into it, and the issue is there are many networks that require an Activity context to function. For example, if you want to integrate AdMob interstitial ads, it requires us to pass in an Activity context:

https://github.com/AppLovin/AppLovin-MAX-SDK-Android/blob/master/Google/src/main/java/com/applovin/mediation/adapters/GoogleMediationAdapter.java#L334

Would your integration have an Activity context by the time of display? One middleground solution I can think of is to allow for a non-Activity context for SDK init and ad load, but not on show.

@omeratesss
Copy link
Author

@thomasmso, your proposed middleground solution aligns perfectly with our requirements. Our aim is to initialize the SDK and load ads using a non-activity context. When it comes to displaying the ad, we intend to utilize activity contexts.

@thomasmso
Copy link
Member

@omeratesss - we're working on this - pushing new adapters to ensure if an Activity context is not needed, we won't look for one when loading. Then to update SDK to allow passing of the Activity context.

To prevent completely breaking current implementations, we'll likely just deprecate existing APIs first while adding the new ones.

@thomasmso
Copy link
Member

@omeratesss - We just released Android SDK v12.5.0. Our MaxInterstitialAd class can be created without requiring an Activity context. Just make sure sure to pass in an Activity context when calling MaxInterstitialAd#show(...).

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

No branches or pull requests

2 participants