Comments (3)
You should be able to load the ad in your Activity A, then show the ad in Activity B. You just need a singleton or something to hold the reference to your instance of MaxInterstitialAd
. An Activity
reference is required due to mediated networks requiring an Activity context so you can't load in your Application
class. Just tested it locally and that works.
from applovin-max-sdk-android.
I am a beginner can you provide some sample code on how to achieve what you just explained
Also i am not using AppLovin max.
If I load the ad in activity A. Can I show it in activity C?
if the user navigation is like this
A->B->C.
from applovin-max-sdk-android.
You mean you are using AppLovin as the only ad network in your app? If that's the case, when you create the AppLovinInterstitialAd
using one of the various methods, you can store it in a static
field somewhere, load the ad, then in Activity B access the interstitial (statically) and call showAd()
.
class Application
{
static AppLovinInterstitialAd sInterstitialAd;
}
class ActivityA extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
Application.sInterstitialAd = AppLovinInterstitialAd.create( AppLovinSdk.getInstance( this ), this );
Application.sInterstitialAd.loadAd();
...
}
class ActivityA extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
if ( Application.sInterstitialAd.isReadyForDisplay() ) {
Application.sInterstitialAd.showAd();
}
}
}
from applovin-max-sdk-android.
Related Issues (20)
- Use play-services-ads-lite instead of play-services-ads HOT 5
- Google UMP: Ads still show up after user chooses do not consent HOT 1
- Whether the custom adapter supports In-app header bidding HOT 1
- Attempt to invoke virtual method 'int android.graphics.drawable.Drawable.getIntrinsicWidth()' on a null object reference at com.applovin.impl.sdk.nativeAd.AppLovinMediaView.getAspectRatio HOT 1
- Crash: java.lang.NoSuchMethodError: No virtual method addNetworkExtrasBundle(Ljava/lang/Class;Landroid/os/Bundle;) HOT 6
- Why does the MaxInterstitialAd object require an activity parameter? HOT 6
- safedk ANR HOT 6
- Remove MaxDebugger**Activity and their res to reduce package size. HOT 1
- AppLovinAdContentRating & AppLovinGender: import fails HOT 1
- LINE adapter is not initialized. HOT 2
- SDK v12.4.0: Initialization is not completed. HOT 5
- Received the mail from the Applovin to update 12.4.1 but the latest release is 12.4.0 HOT 1
- Adapter Missing when integrating vungle-adapter:7.3.1.0 HOT 10
- SDK tries to display ad in own orientation ignoring the requested one HOT 2
- MaxRewardedAd needs to display countdown
- Null Pointer Exception after upgrading SDK to 12.4.2 HOT 8
- Crash: Adding Terms & Privacy with minified build HOT 2
- Ogury sdk update is showing the wrong version in Mediation Debugger HOT 2
- Crash of [base.apk!libmonochrome_64.so] HOT 11
- build.gradle failed in mintegral and bytedance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applovin-max-sdk-android.