Git Product home page Git Product logo

Comments (3)

thomasmso avatar thomasmso commented on July 17, 2024

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.

curiousfellas avatar curiousfellas commented on July 17, 2024

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.

thomasmso avatar thomasmso commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.