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

Could not initialize SDK from background thread #7

Open
gotev opened this issue Oct 11, 2018 · 4 comments
Open

Could not initialize SDK from background thread #7

gotev opened this issue Oct 11, 2018 · 4 comments

Comments

@gotev
Copy link

gotev commented Oct 11, 2018

Hi, using AdForm 1.2.0 on Android 8, in an attempt to reduce initial app loading time, I moved the following statements:

AdformTrackingSdk.startTracking(context, trackingID)
AdformTrackingSdk.setHttpsEnabled(true)

into an IntentService, but then my app crashes and I get the following stack trace

    java.lang.IllegalStateException: Calling View methods on another thread than the UI thread.
        at com.android.webview.chromium.WebViewChromium.b(PG:115)
        at com.android.webview.chromium.WebViewChromium.c(PG:117)
        at com.android.webview.chromium.WebViewChromium.init(PG:45)
        at android.webkit.WebView.<init>(WebView.java:651)
        at android.webkit.WebView.<init>(WebView.java:581)
        at android.webkit.WebView.<init>(WebView.java:564)
        at android.webkit.WebView.<init>(WebView.java:551)
        at android.webkit.WebView.<init>(WebView.java:541)
        at com.adform.adformtrackingsdk.web.AdWebView.<init>(AdWebView.java:36)
        at com.adform.adformtrackingsdk.web.NetworkLoader.<init>(NetworkLoader.java:50)
        at com.adform.adformtrackingsdk.services.SendService.<init>(SendService.java:35)
        at com.adform.adformtrackingsdk.MainHandler.onStart(MainHandler.java:106)
        at com.adform.adformtrackingsdk.general.AbstractHandler.startTracking(AbstractHandler.java:69)
        at com.adform.adformtrackingsdk.AdformTrackingSdk.startTracking(AdformTrackingSdk.java:57)
        at com.adform.adformtrackingsdk.AdformTrackingSdk.startTracking(AdformTrackingSdk.java:38)

because it seems AdForm SDK does something with WebView, which could not be initialized from a background thread. Other tracking solutions are used in the same app, but they all play nice being initialized from a background thread. Is there a way to make AdForm initializable from a background thread, too?

Thank you 😉

@andriusmisiunas
Copy link

Hello,

We see this more as a feature request and will discuss internally. Will let you know about the plans in near future.

Question in the mean time - does a reasonable workaround/approach exist to overcome the issue?

@gotev
Copy link
Author

gotev commented Oct 17, 2018

We currently initialize it on the main thread and it works, but it will be better to offload that in the background

@svabas
Copy link

svabas commented Jun 16, 2020

The feature will be enabled with the upcoming version. ETA - end of July 2020

@gotev
Copy link
Author

gotev commented Jun 16, 2020

Great!

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

No branches or pull requests

3 participants