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

Googleアシスタントアプリの基本からマルチデバイス対応まで

1coin
February 09, 2019

 Googleアシスタントアプリの基本からマルチデバイス対応まで

Android Bazaar&Conference,Diverse 2019 浜松 での登壇資料です。

- https://jaghama.connpass.com/event/112489/?fbclid=IwAR1UbkGR1Fdq5eOwy469wmoQXq6igCBVYxiPozrKVYZlsxYbHWuXrEIU7Ao

1coin

February 09, 2019
Tweet

More Decks by 1coin

Other Decks in Technology

Transcript

  1. U .. 5 3 6 2K G 6 5 2IS

    1 4 2D  Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  2. . . : sakf : : : @ .:. A

    : A @ . . G G Not EbnCM . . . . ) ( r S hDP _N m : gcNhpi C ( ( V V e TV gcdl C Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. B
  3. 1 7 87 8 8 : 8 S IC J

    E@ ( ( 1 1 () T T E C S Y a A S Y G cE@!!! Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.
  4. . . • a A G I • a e

    • • • • . Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. VT c
  5.       Copyright (C) 2019 Namito.Satoyama,

    Shinji.Ichien All Rights Reserved. 
  6.       Copyright (C) 2019 Namito.Satoyama,

    Shinji.Ichien All Rights Reserved. 
  7.        Copyright (C) 2019

    Namito.Satoyama, Shinji.Ichien All Rights Reserved. 
  8. Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  

    Smart Clock / Preview of Google Assistant Connect n 0 1 A -: 29 / : a c gSr s 0 1 A -: 29 7 A1 A - 2A r i G G6AA 9 A17 C1A26 7 2 3 2 A 2 ( ) 6A : n 7 A1 A - 2A n w koegj mE / : a c gS v dekt E G l heg S . : 9 kp
  9. Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  

    KitchenAid Smart Display https://robotstart.info/2019/01/07/kitchenaid-smart-display.html n T 5 5 P 5 G n 5 n Y n IA I X Y
  10. Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  

    https://www.sonos.com/ja-jp/shop/beam.html Google Assistant coming to Sonos One & Sonos Beam n 1 012 n 9
  11. Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  Google

    Assistant coming to more TV devices n    n   n   n    n   https://www.blog.google/products/assistant/coming-soon-google-assistant-android-tv-and-more/ n    https://goo.gl/b5eLGE
  12. eb )( )( )) ) • N j eb N

    F • W ld S j WW • • o N F • W o or oa • • . • W G • . j g • . Copyright (C) 2018 Namito.Satoyama, Shinji.Ichien All Rights Reserved. i s Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. i s
  13.   G GJ G S G P F A

    AC Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  14.    () G GJ G P G S

    F A AC Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  15.    ( ) G G A PG S

    G CJ F C FPG Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  16.    ( ) JP AC J JP AC

    A S JP AC I G FG Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  17. SGC   (  ) A P SGC D

    GC e SGC d f e f F I AF I f b bca J Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  18.   I G C I G F I ic

    I G ic DS P egd LJ b C J ea Af Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  19. • D JN r • . C G O J

    Di D soC • .D S • • aec b • ULI . • . C A Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. l g nf !
  20.   • kwpsjwod0HKQ 2QJ PEKJ 2K 2E A A

    c ! KKCHA /LL 1JCEJA /1! / : 7 • 4 8ulkmoqwptWi a ! KKCHA y nwrv /1 / : 7 ! h g " PPL . CEP Q K PEKJ KJ CKKCHA E HKC HKS SA KKG KEHA LH PA F • 6KPHEJ g ! 9EEP d ebfe PPL . EEP K KEJ , EPA , - - - (() A A /K 0HEAJP 7E T K 6KPHEJd Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.
  21. 31 3. 1 dD B C Copyright (C) 2018 Namito.Satoyama.

    All Rights Reserved. ib nlf • W A • npm install actions-on-google --save • npm install firebase-functions --save Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. ib nlf const { dialogflow } = require('actions-on-google') const functions = require('firebase-functions') const app = dialogflow() exports.endpoint = functions.https.onRequest(app) app.intent( '1 1 / 1 1 , conv => { conv.ask( Gja L c N ID ) }) app.intent( 1 , conv => { conv.close( c em I ) })
  22. Copyright (C) 2018 Namito.Satoyama. All Rights Reserved. st iA y

    p • d Bc • npm install actions-on-google --save • npm install firebase-functions --save • el fLWr d c DialogflowApp a mi Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. st iA y p 3 3. 2 n C D const { dialogflow } = require('actions-on-google') const functions = require('firebase-functions') const app = dialogflow() exports.endpoint = functions.https.onRequest(app) app.intent( ' 2 / , conv => { conv.ask( b uj Gl IN ) }) app.intent( , conv => { conv.close( el o L ) })
  23. Copyright (C) 2018 Namito.Satoyama. All Rights Reserved. yomCu t •

    g Df • npm install actions-on-google --save • npm install firebase-functions --save • p iN wl bgaf A DialogflowApp d m • ' 3 I iN wl (.. ,/ ,/ ,/ ,/ ! ) , ! => I conv.ask conv.close ces Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. yomCu t const { dialogflow } = require('actions-on-google') const functions = require('firebase-functions') const app = dialogflow() exports.endpoint = functions.https.onRequest(app) app.intent( ' / , conv => { conv.ask( ce n W B Ip LG ) }) app.intent( , conv => { conv.close( p s WNBL ) }) . + rGj
  24. 3 1 /3 3 1 I " Copyright (C) 2018

    Namito.Satoyama. All Rights Reserved. a d class ConversationComponentsApp : DialogflowApp() { @ForIntent("Default Welcome Intent") fun welcome(request: ActionRequest): ActionResponse { val responseBuilder = getResponseBuilder(request) responseBuilder .add( b CJC CGA ) return responseBuilder.build() } @ForIntent("Good Bye") fun goodBye(request: ActionRequest): ActionResponse { val responseBuilder = getResponseBuilder(request) responseBuilder .add( CJ K HL ) .endConversation() return responseBuilder.build() } } Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. a d 3 1 • DialogflowApp efC 1
  25. 32/ 2 32 rAi " Copyright (C) 2018 Namito.Satoyama. All

    Rights Reserved. w n t class ConversationComponentsApp : DialogflowApp() { @ForIntent("Default Welcome Intent") fun welcome(request: ActionRequest): ActionResponse { val responseBuilder = getResponseBuilder(request) responseBuilder .add( aeDylH HJ CoH KGA ) return responseBuilder.build() } @ForIntent("Good Bye") fun goodBye(request: ActionRequest): ActionResponse { val responseBuilder = getResponseBuilder(request) responseBuilder .add( go H I G ) .endConversation() return responseBuilder.build() } } • DialogflowApp H / 3/ d • ForIntent f 2 3 3 / b L Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. w n t 32 @ForIntent(“Intent ”) fun method(request: ActionRequest): ActionResponse { // go I v } !
  26. " 3 / 3 w Copyright (C) 2018 Namito.Satoyama. All

    Rights Reserved. n y class ConversationComponentsApp : DialogflowApp() { @ForIntent("Default Welcome Intent") fun welcome(request: ActionRequest): ActionResponse { val responseBuilder = getResponseBuilder(request) responseBuilder .add( bfC oG GI rG DJ ) return responseBuilder.build() } @ForIntent("Good Bye") fun goodBye(request: ActionRequest): ActionResponse { val responseBuilder = getResponseBuilder(request) responseBuilder .add( r G H A ) .endConversation() return responseBuilder.build() } } • DialogflowApp G 3 3 3 e • ForIntent a dg / 3 3 L • ResponseBuilder e wK v l • add(text: String) • add(simpleResponse: SimpleResponse) • add(image: Image) • endConversation() ! bf H Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. n y 3 @ForIntent(“Intentt”) fun method(request: ActionRequest): ActionResponse { // r iH } ! !
  27. Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  

    Multimodal Spectrum n // . GQ D Q n QG MQ : J / . /
  28. Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  

    Google    ./ . n M J :D → → → → → →
  29. /  Copyright (C) 2018 Namito.Satoyama. All Rights Reserved. 

     u tr o i gC a s CA 2 S fcC R e S 2 1 fc lv S 2 2 . 2- Surface lvC a S 2 2 2 . 2- Surfacep hA Sb mn S 2 2 M Surfacep hA Sb mn S Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.  
  30. ) )      !  •

    ( • )) • )( • E ) ) : S A Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.
  31. • 4B A B D ajh • I 4 BD

    C B AC 4 4 B AG A A 4 Copyright (C) 2018 Namito.Satoyama. All Rights Reserved. ij _Egonf const hasScreen = conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT'); const hasAudio = conv.surface.capabilities.has('actions.capability.AUDIO_OUTPUT'); const hasMediaPlayback = conv.surface.capabilities.has('actions.capability.MEDIA_RESPONSE_AUDIO'); const hasWebBrowser = conv.surface.capabilities.has('actions.capability.WEB_BROWSER'); #  if (hasScreen) { conv.ask("  "); } else { conv.close("  "); };       eb ml TMLO S R c N PW U Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. ij _Egonf A
  32. •   • Copyright (C) 2018 Namito.Satoyama. All Rights

    Reserved. C I Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. C I
  33. Copyright (C) 2018 Namito.Satoyama. All Rights Reserved. nob lr -

    : • p c R m af M t • S ) ( ( / ! ? M uv s ie https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Shiba_Inu.jpg/250px-Shiba_Inu.jpg Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. nob lr
  34. )82 1 8 0 -/ - 3 / 1 3

    : • M S li O c • v a tf • (3 1 1 ud A eo Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. rs c n
  35. )82 1 8 0 -/ - 3 / 1 3

    : • M S li O c • v a tf • (3 1 1 ud A eo https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Shiba_Inu.jpg/250px-Shiba_Inu.jpg Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. rs c n
  36. / - 1 - / 4 app.intent('Today Dog - yes',

    conv => { const dogName = conv.data.dogName if (conv.screen) { // %.%+'  } else { const screenAvailable = conv.available.surfaces.capabilities.has('actions.capability.SCREEN_OUTPUT'); if (screenAvailable) { // %. $!*()") const context = '# %&- '; const notification = '# ' + dogName + '%,'; const capabilities = ['actions.capability.SCREEN_OUTPUT']; conv.ask(new NewSurface({ context, notification, capabilities })); } else { // %+'  (  } } }) - Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.
  37. app.intent('Today Dog - yes', conv => { const dogName =

    conv.data.dogName if (conv.screen) { // %.%+'  } else { const screenAvailable = conv.available.surfaces.capabilities.has('actions.capability.SCREEN_OUTPUT'); if (screenAvailable) { // %. $!*()") const context = '# %&- '; const notification = '# ' + dogName + '%,'; const capabilities = ['actions.capability.SCREEN_OUTPUT']; conv.ask(new NewSurface({ context, notification, capabilities })); } else { // %+'  (  } } }) - G M ? ! // - Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. M -2 / 4 2 /
  38. app.intent('Today Dog - yes', conv => { const dogName =

    conv.data.dogName if (conv.screen) { // '0'!-)  } else { const screenAvailable = conv.available.surfaces.capabilities.has('actions.capability.SCREEN_OUTPUT'); if (screenAvailable) { // '0"&#,()$+ const context = ' % '!(/ '; const notification = ' % ' + dogName + ''!.'; const capabilities = ['actions.capability.SCREEN_OUTPUT']; conv.ask(new NewSurface({ context, notification, capabilities })); } else { // '!-)  *  } } }) AoG Client Library NewSurface"&       Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. / - - / 3 4
  39.     • E actions_intent_NEW_SURFACE / / •

    BDI / / app.intent(‘New Surface’, (conv, input, newSurface) => { if (newSurface.status === ‘OK’) { const dogName = conv.data.dogName const dogImageUrl = conv.data.dogImageUrl conv.ask(dogName + '') //   } else { //  } }) Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. - 4 4 / / M
  40.         Copyright (C)

    2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.
  41. app.intent('basic', (conv) => { // h c if (!conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')) {

    conv.close(' R BasicCard '); return; } conv.ask('BasicCard ’); conv.ask(new BasicCard({ title: ' ', subtitle: ' ', text: '** ** ¥n *Ok Google, *', image: new Image({ url: ' URL', alt: ' ', }), buttons: new Button({ title: 'n ', url: 'https://assistant.google.com/services/a/uid/00000045ffe70d1e?hl=ja', }), display: 'CROPPED', })); // Suggest conv.ask(new Suggestions(suggestions)); }); Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. hi e
  42. app.intent('basic', (conv) => { // s if (!conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')) { conv.close('

    BasicCard ci '); return; } conv.ask('BasicCard ci ’); conv.ask(new BasicCard({ title: ' ', subtitle: ' ', text: ‘** ** e *', image: new Image({ url: ' URL', alt: ' ', }), buttons: new Button({ title: ' ', url: 'https://assistant.google.com/services/a/uid/00000045ffe70d1e?hl=ja', }), display: 'CROPPED', })); // hSuggest conv.ask(new Suggestions(suggestions)); }); p Simple Response / R n Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. s o
  43. SSML Copyright (C) 2018 Namito.Satoyama. All Rights Reserved.  

     11 3 31 /: / / 1 • TWR L X • . C TWCA • - G • 3 : 11 3 31 • 1C S M Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.   
  44. / <> / .0 " <> / L <speak> 

         break 0.5 S M = Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. 5
  45. - - > - - - - Copyright (C) 2019

    Namito.Satoyama, Shinji.Ichien All Rights Reserved. D
  46. oqpr . G= A A ; / = AG =

    5 T A G 5CC , A 0=5 ;: .CC L D G C A M" A G 5; , g + 5> G= , ' ( e a } aik n ubml 5CC G + C 5> 5; + C 5> " } aik uhx fml A G = C 5 5; , gdc 5CC G L C <) + C 5> 5; + C 5> = C 5 G) = C 5 5; M" Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. {ts yʼ w
  47.  0 = . " = 5 0  

     0 = / = 5 0 < > time strength > Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.
  48. 23 >0 0> 7 =<= 0> 20=37 08 >0 0>

    23 76 >0 0> 7 =<= 0> =37 08 >0 0> > >0 0> 7 =<= 0> 30 = 0 33 " " "" >0 0> >0 0> 7 =<= 0> 7 = 0 0 3 078 " >0 0> - + >0 0> 7 =<= 0> 260=02 => / - >0 0> 4 >0 0> 7 =<= 0> 8 <6 = 0 " "" " >0 0> 8< 1 S >0 0> 7 =<= 0> 18 < S >0 0> >0 0> E P C Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. a
  49. 3 % " 1 3 >=2 C U L 0

    D 3 >2 / 3 >2 1 3 3 % 1 3 >=2 C U L 0 D >< 3 "" 3 >2 / 3 >2 1 3 >< 3 "" 0 3 1% 0 3 1 % 3 2 1 % 3 % " 1 3 >=2 C U L 0 D >< 3 "" 2 < "> 2 < 3 > = < 1 % = < 1 = > 3 >2 / 3 >2 1 3 1 3 U L E Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved. T BR
  50.       Copyright (C) 2019 Namito.Satoyama,

    Shinji.Ichien All Rights Reserved. 
  51.   / : . / Copyright (C) 2019 Namito.Satoyama,

    Shinji.Ichien All Rights Reserved.  
  52.  • Google"$%&1*K57LI  • Google"$%&1*F)+#% >9 E6 -/')+#%8 <!

    • AudioVisual0%,1%  >9  AMB4G2=? • .('UIHD3;2= :J8   C@ Copyright (C) 2019 Namito.Satoyama, Shinji.Ichien All Rights Reserved.