Android WebView PictureListener Deprecated - Still No Alternatives?

This is similar to other questions already asked in the past, but with a new twist. The notification about the completion of WebView capturePicture() is onNewPicture , but the latest documentation says that the image returned in this case will always be null from API 18 (Android 4.3).

WebView.PictureListener

So far, I have verified that it still works on Android 4.0.3 (and the attempt to use the captured image fails if I do not wait for notification).

What should we use as a replacement? Will the image be immediately returned to onPageFinished or when WebChromeClient progress notifies 100%?



Update


API-18 (Android 4.3) appeared on the SDK a couple of days ago. onNewPicture still sends the captured image to the emulator. Unfortunately, I do not have a real device with Android 4.3.

+4
source share
1 answer

Actually it depends on the targetSdkLevel your application. For compatibility, onNewPicture still sends the image if the target level is <18 (JB MR2).

The preferred approach for capturing a WebView image is to make it draw on the Canvas provided by you, see, for example, What can replace the capturePicture function

0
source

Source: https://habr.com/ru/post/1493578/


All Articles