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
webMessaging
Search
funnelbit
July 14, 2015
Technology
1
2.7k
webMessaging
funnelbit
July 14, 2015
Tweet
Share
More Decks by funnelbit
See All by funnelbit
Hatena Engineer Seminar #9
funnelbit
5
7.1k
droidkaigi-2017-renovation
funnelbit
10
10k
Dart
funnelbit
0
250
BottomBarAndSnackBar
funnelbit
0
460
Dagger2 Optional bindings
funnelbit
0
530
WearableRecyclerView
funnelbit
1
760
QucikSettingsTileAPI
funnelbit
0
340
Mobile Vision
funnelbit
0
430
AwarenessAPI
funnelbit
0
130
Other Decks in Technology
See All in Technology
サイロ化した金融システムを、packwerk を利用して無事故でリファクタリングした話
coincheck_recruit
3
3.2k
失敗しないOpenJDKの非互換調査
tabatad
0
230
チームを主語にしてみる / Making "Team" the Subject
ar_tama
2
180
Mobbing Practices
kawaguti
PRO
3
340
Trusted Types API と Vue.js
lycorptech_jp
PRO
1
300
初心者に Vue.js を 教えるには
tsukuha
3
210
dbt-coreで実現するCore DataMartsのデータモデリング〜dbt編〜 / Core DataMarts Modeling with dbt-core
i125
3
1.2k
omakaseしないための.rubocop.yml のつくりかた / How to Build Your .rubocop.yml to Avoid Omakase #kaigionrails
linkers_tech
3
210
生成AIの強みと弱みを理解して、生成AIがもたらすパワーをプロダクトの価値へ繋げるために実践したこと / advance-ai-generating
cyberagentdevelopers
PRO
0
120
EKS初心者が早めに知っておきたかったこと
cuorain
0
140
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
3
840
話題のGraphRAG、その可能性と課題を理解する
hide212131
0
150
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
Navigating Team Friction
lara
183
14k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
How to train your dragon (web standard)
notwaldorf
88
5.6k
GitHub's CSS Performance
jonrohan
1030
460k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
A Modern Web Designer's Workflow
chriscoyier
692
190k
4 Signs Your Business is Dying
shpigford
180
21k
Music & Morning Musume
bryan
46
6.1k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
Code Review Best Practice
trishagee
64
17k
Transcript
"OESPJE.͔Βͷ 8FC.FTTBHJOH JEGVOOFMCJU
͜Μʹͪ w JEGVOOFMCJU w ଜɹྋ
+4ͱ+BWBͷ௨৴
ݱঢ়ͷ+4ͱͷ௨৴ +4ʹ͢ mWebView.loadUrl( "javascript:document.getElementById('content').innerHTML=\ "͜Μʹͪ\""); mWebView.evaluateJavascript( "var content = document.getElementById('content');"
+ "content.innerHTML = \"͜Μʹͪ\"" , null); w "1*-FWFMd
͜Ε·Ͱͷ+4ͱͷ௨৴ +4͔Βड͚औΔ mWebView.addJavascriptInterface(new JavaScriptInterface(), “Callback"); private class JavaScriptInterface { @JavascriptInterface
public void onEdit(String text) { // ͜Μʹͪ } }
໘ w +4ʹͪΐͬͱΛ͚ͩ͢Ͱ͍͢͝खؒ w จࣈྻͳ+4͕+BWBʹฆΕࠐΉ
)5.-8FC.FTTBHJOH w JGSBNFXJOEPXؒͷ௨৴ΛՄೳͱ͢Δ w QPTU.FTTBHF w .FTTBHF$IBOOFMΛར༻ͨ͠ QPTU.FTTBHF
QPTU.FTTBHF JGSBNFTSDlEPNFJOzJGSBNF ʜ WBSJGSBNFEPDVNFOUHFU&MFNFOU#Z*E QBHF JGSBNFDPOUFOU8JOEPXQPTU.FTTBHF ͜Μʹͪ lEPNBJOl
WBSSFDFJWF.FTTBHFGVODUJPO FWFOU \ DPOTPMFMPH PL ^ XJOEPXBEE&WFOU-JTUFOFS NFTTBHF SFDFJWF.FTTBHF w QBHF w QBHF
QPTU.FTTBHF NFTTBHFDIBOOFM WBSSFDFJWF.FTTBHFGVODUJPO FWFOU \ WBSQPSUFWFOUQPSUT<> QPSUTUBSU QPSUQPTU.FTTBHF ͋Γ͕ͱ͏
^ XJOEPXBEE&WFOU-JTUFOFS NFTTBHF SFDFJWF.FTTBHF GBMTF w QBHF w QBHF WBSDIBOOFMOFX.FTTBHF$IBOOFM WBSJGSBNFEPDVNFOUHFU&MFNFOU#Z*E QBHF WBSQPSUDIBOOFMQPSU QPSUTUBSU QPSUBEE&WFOU-JTUFOFS NFTTBHF GVODUJPO F \ DPOTPMFMPH Αͬ͠Ό ^ JGSBNFDPOUFOU8JOEPXQPTU.FTTBHF ͜Μʹͪ <DIBOOFMQPSU>
8FC.FTTBHF༻ Ϋϥεͱϝιου w BOESPJEXFCLJU w 8FC.FTTBHF w 8FC.FTTBHF1PSU w 8FC.FTTBHF1PSUQPTU.FTTBHF
w 8FC.FTTBHF1PSU8FC.FTTBHF$BMMCBDL w BOESPJEXFCLJU8FC7JFX w 8FC7JFXDSFBUF8FC.FTTBHF$IBOOFM w 8FC7JFXQPTU8FC.FTTBHF
w ૹ৴͢ΔϝοηʔδΛදͨ͠Ϋϥε WebMessage webMessage = new WebMessage("͜Μʹͪ"); w .FTTBHF1PSUTΛҾʹऔΕΔ WebMessage
webMessage = new WebMessage("portͩΑ", ports); 8FC.FTTBHF
w .FTTBHF$IBOOFMͰ͏ϙʔτ w +4ͷ.FTTBHF$IBOOFMQPSUPS .FTTBHF$IBOOFMQPSU૬ 8FC.FTTBHF1PSU
w .FTTBHF$IBOOFMͰQPTU͢Δ mWebMessagePort1.postMessage(webMessage); 8FC.FTTBHF1PSU QPTU.FTTBHF 8FC.FTTBHF
w .FTTBHF$IBOOFMͰड৴ͨ͠༰Λड͚औΔ port1.setWebMessageCallback(new WebMessagePort.WebMessageCallback() { @Override public void onMessage(WebMessagePort port,
WebMessage message) { super.onMessage(port, message); Log.e("onMessage", message.getData()); } }); 8FC.FTTBHF1PSU8FC.FT TBHF$BMMCBDL
w .FTTBHF$IBOOFMΛ࡞Δ w ྻͰQPSU͕ͭฦͬͯ͘Δ mWebMessagePorts = mWebView.createWebMessageChannel(); WebMessagePort port1 =
mWebMessagePorts[0]; WebMessagePort port2 = mWebMessagePorts[1]; 8FC7JFX DSFBUF8FC.FTTHF$IBOOFM
w 8FC7JFXͰදࣔதͷ1BHFʹQPTU.BTTBHF͢Δ mWebView.postWebMessage(webMessage, uri); 8FC7JFX QPTU8FC.FTTBHF
ྫ
ྫ mWebMessagePorts = mWebView.createWebMessageChannel(); WebMessagePort port1 = mWebMessagePorts[0]; WebMessagePort port2
= mWebMessagePorts[1]; … port1.setWebMessageCallback(new WebMessagePort.WebMessageCallback() { … }}); … WebMessagePort[] ports = {port2}; WebMessage webMessage = new WebMessage("͜ΜʹͪportsͰ͢ ", ports); mWebView.postWebMessage(webMessage, uri);
·ͱΊ w +BWBʹจࣈྻͳ+4͕ฆΕࠐ·ͳ͍ w )5.-ͷඪ४ͳͷͰ൚༻త w ·ͩQSFWJFXஈ֊Ͱมߋ͕ଟ͍ͷͰҙ QSFWJFXQPTU.FTTBHF5P.BJO'SBNF QSFWJFXQPTU8FC.FTTBHF
͋Γ͕ͱ͏͍͟͝·ͨ͠