Closed Averus89 closed 4 years ago
It doesn't look like the html has anything crazy in it that should end up with a timeoutException. Did you try increasing the timeouts of the bitmap generation to see if that makes any difference? Does that html work if inputted into the test application from the releases-page?
I've tried to increase timeout to 30s, 1 min, 3 mins, 5 mins - still got timeout exception and blocked my UI for the time - got ANR few times during that timeframes. This html loads perfectly in WebView in UI, and also I've noticed if I generate it in WebView in the activity first - doesn't get timeout, so the page must be rendered and cached somewhere.
I've managed to reuse some of the code in the library to create simplified version with 1s timeout after 100% progress onPageLoad - this renders bitmap correctly. I've found on the stackoverflow that the 100% progress refers to data read into WebView, and rendering it's another case indepentent of that value.
Ah.. so if you got an ANR you are probably calling the library from the mainThread (as the library tries to not lock up the main thread more than necessary). The library does however need to post callbacks on the main thread as it's a requirement by the WebView on android. Potentially what could be happening is that if you are locking the main thread the library is unable to send those callbacks and hence you get stuck in a deadlock until the timeout occurs.
Try to move your invocation of "generateBitmap" off the mainThread and see if it works better.
Also please try the provided test-application from the releases pages as that might be a way for you to start out with working code and mutating it into what you need.
@BeeeQueue Could you close this one too? :)
Would you be up for having the project transferred to your profile? I can ask around to see if I can get it done
I would be open to it. Your asking around would be appreciated. :)
Hi,
I'm trying to generate bitmap using 1.10 version of the library, and when trying to use this html I'm getting timeout exception.
Maybe this could be usefull
And the html put into the client