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

onSdkInitialized method is not triggered when I initialize the SDK without an Activity. #673

Open
mertkesgin opened this issue Jun 10, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mertkesgin
Copy link

MAX SDK Version

12.5.0

Device/Platform Info

Android

Current Behavior

I am trying to initialize the SDK without Activity. Although the SDK is initialized, the onSdkInitialized method is not triggered.

val initConfig = AppLovinSdkInitializationConfiguration
            .builder(applovinAppId, getApplicationContext())
            .setMediationProvider(AppLovinMediationProvider.MAX)
            .build()

AppLovinSdk.getInstance(getApplicationContext())
    .initialize(initConfig) {
        // This block is never triggered
    }

I can see the following error in the logs;

[AppLovinSdk] Auto-initing adapters for non-MAX mediation provider: admob
[AppLovinSdk] 
**********
Attempting to init 3rd-party SDKs without an Activity instance.
**********

This is how I know that the SDK is initialized even though the onSdkInitialized method is not triggered;

scope.launch {
    while (true) {
        Log.d(TAG, "isInitialized: ${appLovinSdk.isInitialized}")
        if (appLovinSdk.isInitialized) break
        delay(500)
    }
}

NOTE: When I initialize the SDK from an Activity, the onSdkInitialized method is triggered.

Expected Behavior

After initializing the SDK without Activity, the onSdkInitialized method must be triggered;

val initConfig = AppLovinSdkInitializationConfiguration
            .builder(applovinAppId, getApplicationContext())
            .setMediationProvider(AppLovinMediationProvider.MAX)
            .build()

AppLovinSdk.getInstance(getApplicationContext())
    .initialize(initConfig) {
        // This block must be triggered when the SDK is initialized.
    }

How to Reproduce

You can try to initialize the SDK without Activity.

Additional Info

No response

@mertkesgin mertkesgin added the bug Something isn't working label Jun 10, 2024
@cemtuver-applovin cemtuver-applovin self-assigned this Jun 11, 2024
@cemtuver-applovin
Copy link

Hey @mertkesgin! I have created a sample project in which the AppLovin SDK was initialized in a service without an Activity. However, I was unable to reproduce the issue, and the callback was invoked as expected.

I believe the issue you are facing is due to you and AdMob Mediation trying to initialize our SDK simultaneously. While you are setting the mediation provider to "MAX", the logs show mediation provider: admob. Could you please check if this might be the case for you?

Please let me know if this fixes the callback issue for you.

@mertkesgin
Copy link
Author

Even when I disable AdMob and initialize the AppLovin SDK, the same issue persists. Could you please add the following scenario to your sample project and test it again?

anyRxSingleFunction()
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .doOnSuccess { 
                // Init AppLovin SDK
            }
            .subscribe()
            .addTo(compositeDisposable)

@cemtuver-applovin
Copy link

Hi @mertkesgin, thanks for checking. Would you be able to create a sample Android Studio project where this issue reproduces and share the project with me? This will allow me to investigate your use case directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants