Slide 1

Slide 1 text

"OESPJE.͔Βͷ 8FC.FTTBHJOH JEGVOOFMCJU

Slide 2

Slide 2 text

͜Μʹͪ͸ w JEGVOOFMCJU w ๺ଜɹྋ

Slide 3

Slide 3 text

+4ͱ+BWBͷ௨৴

Slide 4

Slide 4 text

ݱঢ়ͷ+4ͱͷ௨৴ +4ʹ౉͢ mWebView.loadUrl( "javascript:document.getElementById('content').innerHTML=\ "͜Μʹͪ͸\""); mWebView.evaluateJavascript(
 "var content = document.getElementById('content');" +
 "content.innerHTML = \"͜Μʹͪ͸\""
 , null); w "1*-FWFMd

Slide 5

Slide 5 text

͜Ε·Ͱͷ+4ͱͷ௨৴ +4͔Βड͚औΔ mWebView.addJavascriptInterface(new JavaScriptInterface(), “Callback"); private class JavaScriptInterface {
 @JavascriptInterface
 public void onEdit(String text) {
 // ͜Μʹͪ͸
 }
 }

Slide 6

Slide 6 text

໘౗ w +4ʹͪΐͬͱ஋Λ౉͚ͩ͢Ͱ΋͍͢͝खؒ w จࣈྻͳ+4͕+BWB಺ʹฆΕࠐΉ

Slide 7

Slide 7 text

)5.-8FC.FTTBHJOH w JGSBNFXJOEPXؒͷ௨৴ΛՄೳͱ͢Δ w QPTU.FTTBHF w .FTTBHF$IBOOFMΛར༻ͨ͠ QPTU.FTTBHF

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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 ͜Μʹͪ͸

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

w ૹ৴͢ΔϝοηʔδΛදͨ͠Ϋϥε WebMessage webMessage = new WebMessage("͜Μʹͪ͸"); w .FTTBHF1PSUTΛҾ਺ʹऔΕΔ WebMessage webMessage = new WebMessage("portͩΑ", ports); 8FC.FTTBHF

Slide 12

Slide 12 text

w .FTTBHF$IBOOFMͰ࢖͏ϙʔτ w +4ͷ.FTTBHF$IBOOFMQPSUPS .FTTBHF$IBOOFMQPSU૬౰ 8FC.FTTBHF1PSU

Slide 13

Slide 13 text

w .FTTBHF$IBOOFMͰQPTU͢Δ mWebMessagePort1.postMessage(webMessage); 8FC.FTTBHF1PSU QPTU.FTTBHF 8FC.FTTBHF

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

w .FTTBHF$IBOOFMΛ࡞Δ w ഑ྻͰQPSU͕ͭฦͬͯ͘Δ mWebMessagePorts = mWebView.createWebMessageChannel();
 WebMessagePort port1 = mWebMessagePorts[0];
 WebMessagePort port2 = mWebMessagePorts[1]; 8FC7JFX DSFBUF8FC.FTTHF$IBOOFM

Slide 16

Slide 16 text

w 8FC7JFXͰදࣔதͷ1BHFʹQPTU.BTTBHF͢Δ mWebView.postWebMessage(webMessage, uri); 8FC7JFX QPTU8FC.FTTBHF

Slide 17

Slide 17 text

Slide 18

Slide 18 text

ྫ 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);

Slide 19

Slide 19 text

·ͱΊ w +BWB಺ʹจࣈྻͳ+4͕ฆΕࠐ·ͳ͍ w )5.-ͷඪ४ͳͷͰ൚༻త w ·ͩQSFWJFXஈ֊Ͱมߋ͕ଟ͍ͷͰ஫ҙ QSFWJFXQPTU.FTTBHF5P.BJO'SBNF QSFWJFXQPTU8FC.FTTBHF

Slide 20

Slide 20 text

͋Γ͕ͱ͏͍͟͝·ͨ͠