Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebView😇😇😇
Search
Keishin Yokomaku
November 28, 2017
Technology
0
870
WebView😇😇😇
Keishin Yokomaku
November 28, 2017
Tweet
Share
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
One screen, many BottomSheets
keithyokoma
0
350
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
590
Build apps for Cars
keithyokoma
0
480
Save the state
keithyokoma
0
530
Either in Kotlin
keithyokoma
0
540
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
5k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
5k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
510
DX Improvements
keithyokoma
3
380
Other Decks in Technology
See All in Technology
Classmethod AI Talks(CATs) #17 司会進行スライド(2025.02.19) / classmethod-ai-talks-aka-cats_moderator-slides_vol17_2025-02-19
shinyaa31
0
180
Windows の新しい管理者保護モード
murachiakira
0
200
PHPカンファレンス名古屋-テックリードの経験から学んだ設計の教訓
hayatokudou
2
530
Potential EM 制度を始めた理由、そして2年後にやめた理由 - EMConf JP 2025
hoyo
2
1.8k
Visualize, Visualize, Visualize and rclone
tomoaki0705
9
77k
IAMポリシーのAllow/Denyについて、改めて理解する
smt7174
2
180
Raycast AI APIを使ってちょっと便利な拡張機能を作ってみた / created-a-handy-extension-using-the-raycast-ai-api
kawamataryo
0
200
OpenID Connect for Identity Assurance の概要と翻訳版のご紹介 / 20250219-BizDay17-OIDC4IDA-Intro
oidfj
0
470
ソフトウェアエンジニアと仕事するときに知っておいたほうが良いこと / Key points for working with software engineers
pinkumohikan
1
140
設計を積み重ねてシステムを刷新する
sansantech
PRO
0
140
Iceberg Meetup Japan #1 : Iceberg and Databricks
databricksjapan
0
300
RemoveだらけのPHPUnit 12に備えよう
cocoeyes02
0
170
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Practical Orchestrator
shlominoach
186
10k
How GitHub (no longer) Works
holman
314
140k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
Statistics for Hackers
jakevdp
797
220k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Transcript
WebView Keishin Yokomaku (@KeithYokoma) / potatotips #45
WebView Keishin Yokomaku 2 potatotips #45 Drivemode, Inc. / Principal
Engineer @KeithYokoma: GitHub / Twitter / Qiita / Tumblr / Stack Overflow
3 WebView
WebView Կ͔ͱ᠘ͷଟ͍ WebView ▸ Θ͔Δ ▸ ੲSIGSEGVβϥͩͬͨཕݪͷΑ͏ͳͷ 4 potatotips #45
WebView ChromeCustomTabs ͕͋Δ͔Β WebView ͍Βͳ͍ࢠ ▸ ͦΜͳ;͏ʹߟ͍͑ͯͨ࣌ظ͕Θͨ͠ʹ͋Γ·ͨ͠ 5 potatotips #45
WebView ·ͩ WebView Ͱফ͍ͯ͠Δͷʁ ▸ Θ͍ͨͯ͠͠·͢ 6 potatotips #45
WebView ࠓͷ WebView ᠘Ϩγϐ ▸ e.g. ๏తใΛ WebView Ͱදࣔ͢Δ ▸
assets ʹ html Λஔ͍ͯ WebView ʹಡ·ͤΔ ▸ ֎෦ϦϯΫ͕ͳ͚Ε࠷खܰʹࡁ·ͤΒΕΔ ▸ ಉ͡ assets ͷ html ʹϦϯΫ͢Δ߹؆୯ ▸ e.g. file:///android_asset/privacy_policy.html 7 potatotips #45
WebView StrictMode ▸ ThreadPolicy ͱ VmPolicy ▸ ͋Γ͕ͪͳ࣮ͷؒҧ͍Λݕग़ͯ͠ϩάग़ྗΫϥογϡΛൃੜͤ͞Δ ▸ ϝΠϯεϨουͰ
I/O ▸ Ϧιʔεͷ close Ε ▸ ΧελϜ͢Δͱ͖ඞཁͳͷͯ͢Λ༗ޮʹ͢Δ ▸ ༗ޮʹͯ͠ͳ͍ͷεϧʔ͞ΕΔ 8 potatotips #45
WebView Android Nougat ͷηΩϡϦςΟ༷ ▸ FileUriExposureException ▸ File εΩʔϚͷ Uri
Λ Intent ʹ͍Εͯڞ༗Ͱ͖ͳ͘ͳͬͨ ▸ FileProvider ͷ ContentProvider Ͱڞ༗͢Δ ▸ StrictMode ʹΦϓγϣϯ͕͋Δ ▸ VmPolicy#penaltyDeathOnFileUriExposure() 9 potatotips #45
WebView WebView#loadUrl() ͷ༷ ▸ WebViewClient Λࢦఆͨ͠ͱ͖ ▸ shouldOverrideUrlLoading ͕ true:
ΞϓϦͰಡΈࠐΈΛཧ ▸ shouldOverrideUrlLoading ͕ false: WebView ͕ಡΈࠐΈΛཧ ▸ WebViewClient Λࢦఆ͠ͳ͍ͱ͖ ▸ ActivityManager ʹ͍߹ΘͤͯదͳͷΛݺͼग़͢ 10 potatotips #45
WebView WebView#loadUrl() ͷ༷ ▸ WebViewClient Λࢦఆͨ͠ͱ͖ ▸ shouldOverrideUrlLoading ͕ true:
ΞϓϦͰಡΈࠐΈΛཧ ▸ shouldOverrideUrlLoading ͕ false: WebView ͕ಡΈࠐΈΛཧ ▸ WebViewClient Λࢦఆ͠ͳ͍ͱ͖ ▸ ActivityManager ʹ͍߹ΘͤͯదͳͷΛݺͼग़͢ 11 potatotips #45
WebView ActivityManager ʹ͍߹ΘͤͯదͳͷΛݺͼग़͢ ▸ Intent Λ͛ͯϋϯυϧͯ͘͠ΕΔΞϓϦΛ୳͢ ▸ ଘࡏ͢ΕͦͪΒʹ͢ ▸ ଘࡏ͠ͳ͚Ε
WebView ͕ϋϯυϧ͢Δ ▸ ͍ͣΕʹͯ͠ Intent ʹಡΈࠐΉ Uri ͕٧Ίࠐ·ΕΔ 12 potatotips #45
WebView ActivityManager ʹ͍߹ΘͤͯదͳͷΛݺͼग़͢ ▸ Intent Λ͛ͯϋϯυϧͯ͘͠ΕΔΞϓϦΛ୳͢ ▸ ଘࡏ͢ΕͦͪΒʹ͢ ▸ ଘࡏ͠ͳ͚Ε
WebView ͕ϋϯυϧ͢Δ ▸ ͍ͣΕʹͯ͠ Intent ʹಡΈࠐΉ Uri ͕٧Ίࠐ·ΕΔ ▸ file:///android_asset/hogehoge.html ͳϦϯΫΛ౿Ήͱ… 13 potatotips #45
14 potatotips #45
WebView WebView Λ͏ͱ͖ͷڭ܇ ▸ WebViewClient Λ͖ͪΜͱ͍·͠ΐ͏ ▸ ֎෦ϦϯΫ JavaScript ͕ͳ͍͔ΒͱݴͬͯԿ͠ͳͯ͘Α͍Θ͚Ͱͳ͍
15 potatotips #45
WebView Keishin Yokomaku (@KeithYokoma) / DroidKaigi 2017
Drivemode We are hiring! 17 potatotips #45
Drivemode We are hiring! 18 potatotips #45
DroidKaigi DroidKaigi 2018 is coming soon! ▸ Ticket: ▸ Early
Bird: 9,800 JPY ▸ Regular: 12,000 JPY ▸ Students: 4,000 JPY 19 potatotips #45