Right-click the assets folder and then click New > File. Create an assets folder for your project. to support API src > main folder and thenįigure 1. Return assetLoader.shouldInterceptRequest(request.url) Private class LocalContentWebViewClient(private val assetLoader: WebViewAssetLoader) : WebViewClientCompat() fun shouldInterceptRequest( The following is anĮxample of loading simple web content from the assets folder: Include WebViewAssetLoader in your main activity file. Loading subresources such as JavaScript, CSS, images, and iframes. Loading content with an HTTP(S) URL for compatibility with the same-origin.WebViewAssetLoaderįlexible and performant way to load in-app content in a Requires shipping a new app update, and there is the possibility of mismatchedĬontent between what's on a web site and what's in the app on your device if However, there are some drawbacks to in-app content. In-app content doesn't require internet access or consume a user's bandwidth,Īnd if the content is designed specifically for WebView-only-that is, itĭepends on communicating with a native app-then users can't accidentally You can provide web-based content-such as HTML, JavaScript, andĬSS-for your app to use that you statically compile into the application
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |