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
770
WebView😇😇😇
Keishin Yokomaku
November 28, 2017
Tweet
Share
More Decks by Keishin Yokomaku
See All by Keishin Yokomaku
LazyColumnのitemがViewPortの中で占める領域の割合を知りたい
keithyokoma
0
410
Build apps for Cars
keithyokoma
0
370
Save the state
keithyokoma
0
430
Either in Kotlin
keithyokoma
0
410
持続的なアプリ開発のためのDXを支える技術
keithyokoma
2
4.6k
Make the objects serializable with kotlinx.serialization
keithyokoma
0
4.5k
Kotlin で書く Gradle Custom Tasks
keithyokoma
0
460
DX Improvements
keithyokoma
3
360
Get Things Done with Gradle Custom Tasks
keithyokoma
1
93
Other Decks in Technology
See All in Technology
反実仮想機械学習とは何か
usaito
PRO
9
3.3k
MapLibreとAmazon Location Service
dayjournal
1
150
開発生産性大幅アップ!Postman VS Code拡張機能
nagix
2
360
検証を通して見えてきたTiDBの性能特性
lycorptech_jp
PRO
6
3.7k
私が trocco を推す理由
__allllllllez__
1
200
web-application-security
matsuihidetoshi
0
140
MLOpsの「壁」を乗り越える、LINEヤフーの Data Quality as Code
lycorptech_jp
PRO
5
400
Vertex AI を中心に 生成AIのアップデートを共有します
kaz1437
0
290
VSCodeの拡張機能を作っている話
ebarakazuhiro
1
200
MySQL の SQL クエリチューニングの要所を掴む勉強会
andpad
2
6k
元インフラエンジニアに成る / Human Resources to Human Relations
bobtani
4
890
TechFeed Experts Night#27 〜 フロントエンドフレームワーク最前線 (Svelte)
baseballyama
1
180
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
Adopting Sorbet at Scale
ufuk
68
8.6k
What's in a price? How to price your products and services
michaelherold
237
11k
How GitHub (no longer) Works
holman
304
140k
For a Future-Friendly Web
brad_frost
172
9k
GraphQLとの向き合い方2022年版
quramy
32
12k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Done Done
chrislema
178
15k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
Happy Clients
brianwarren
92
6.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
25
2.3k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
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