Upgrade to Pro — share decks privately, control downloads, hide ads and more …

webMessaging

 webMessaging

funnelbit

July 14, 2015
Tweet

More Decks by funnelbit

Other Decks in Technology

Transcript

  1. 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
  2. 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> 
  3. 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
  4. 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
  5. w .FTTBHF$IBOOFMΛ࡞Δ w ഑ྻͰQPSU͕ͭฦͬͯ͘Δ mWebMessagePorts = mWebView.createWebMessageChannel();
 WebMessagePort port1 =

    mWebMessagePorts[0];
 WebMessagePort port2 = mWebMessagePorts[1]; 8FC7JFX DSFBUF8FC.FTTHF$IBOOFM
  6. ྫ 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);