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

isSdkInitialized returns false in SdkInitializationListener after succeeded initialization #711

Closed
rmattis opened this issue Nov 7, 2023 · 2 comments · Fixed by #761
Closed
Assignees

Comments

@rmattis
Copy link

rmattis commented Nov 7, 2023

Describe the bug
When calling

PrebidMobile.initializeSdk(context) {
    Log.d("Highfivve", "Successfully initialized PrebidMobile: ${it.name}")
    Log.d("Highfivve", "Prebid Mobile initialized: ${PrebidMobile.isSdkInitialized()}")
}

i would expect that isSdkInitialized returns true.
This would not be a problem, if I wouldn't want to request bids inside the InitializationListener.
When I try this, this leads to the following error:
PrebidBidLoader: SDK wasn't initialized. Context is null.

To Reproduce
Steps to reproduce the behavior:

  1. Initialize PrebidMobile
  2. Call PrebidMobile.isSdkInitialized() inside the initialization listener
  3. Request Bid inside the InitializationListener

Expected behavior
I would expect PrebidMobile.isSdkInitialized() to return true and also that bids can be requested inside the InitializationListener.

Screenshots

  • None

Desktop (please complete the following information):

  • None

Smartphone (please complete the following information):

  • Android (using Prebid-Mobile)

Additional context
The fix would be to move this line above the listener.onInitializationComplete

I just wanted to discuss whether there is any reason for this behaviour or if I can just submit a merge request to fix this behaviour.

@positivefx
Copy link

I am also running into the same error: PrebidBidLoader: SDK wasn't initialized. Context is null. when on the MainActivity page. But if I navigate to the SecondActivity or Dialog prebid runs as expected.

@andreasreuter
Copy link

andreasreuter commented Feb 15, 2024

I debugged this problem, and it seems a bug in the order of the code.

  1. It says "context is null" which isn't correct. Because the function wereTasksCompletedSuccessfully returns the false.

Screenshot 2024-02-15 at 12 03 48

  1. The state variable "tasksCompletedSuccessfully" must be set to true before the "onInitializationComplete" callback is called.

Screenshot 2024-02-15 at 12 06 34

Does this clarify the problem?

@jsligh jsligh moved this from Triage to Ready for Dev in Prebid Mobile Prioritization Jun 3, 2024
@jsligh jsligh moved this from Ready for Dev to In Progress in Prebid Mobile Prioritization Jun 4, 2024
@jsligh jsligh self-assigned this Jun 4, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Prebid Mobile Prioritization Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants