Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Navigate users from assistant app to android app

257 views

Published on

How to navigate your users from your assistant app to some android app.

Published in: Technology
  • Login to see the comments

  • Be the first to like this

Navigate users from assistant app to android app

  1. 1. Navigate users from Assistant App to Android App 2017/12/19 APP DOJO
  2. 2. Yoichiro Tanaka Software Engineer / IT Architect Google Developers Expert (Web) twitter.com/yoichiro google.com/+YoichiroTanaka
  3. 3. Surfaces Support audio experiences only Support screen experiences only Support both audio and screen experiences
  4. 4. App surface capabilities
  5. 5. Simple Responses Supported on ● actions.capability.AUDIO_OUTPUT ● actions.capability.SCREEN_OUTPUT
  6. 6. Rich Responses - Basic Card Supported on ● actions.capability.SCREEN_OUTPUT Image, Title, Sub-title, Text body, Link button, Border
  7. 7. 1. Check whether a surface the user is using supports a screen. [Yes] 2. Send a Basic Card with a Link Button. [No] 3. Check whether the user has a surface which is supporting a screen. [Yes] 4. Request to transfer the user to the surface. [Yes] 5. Send a Basic Card with a Link Button. Send a Basic Card w/ a Link Button ?
  8. 8. "use strict"; process.env.DEBUG = "actions-on-google:*"; const App = require("actions-on-google").DialogflowApp; const functions = require("firebase-functions"); exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { const app = new App({request, response}); const inputWelcome = (app) => { // for Default Welcome Intent }; const actionMap = new Map(); actionMap.set("input.welcome", inputWelcome); app.handleRequest(actionMap); });
  9. 9. // 1. Check whether a surface the user is using supports a screen const screenSupported = app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT); if (screenSupported) { // 2. Send a Basic Card with Link Button } else { // 3. Check whether the user has a surface which is supporting a screen. const screenAvailable = app.hasAvailableSurfaceCapabilities(app.SurfaceCapabilities.SCREEN_OUTPUT); if (screenAvailable) { // 4. Request to transfer the user to the surface. const context = "<context>"; const notificationTitle = "<title>"; app.askForNewSurface( context, notificationTitle, [app.SurfaceCapabilities.SCREEN_OUTPUT]); } else { ... } }
  10. 10. exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { const app = new App({request, response}); const inputWelcome = (app) => { ... }; const newSurface = (app) => { // 5. Send a Basic Card with a Link Button. }; const actionMap = new Map(); actionMap.set("input.welcome", inputWelcome); actionMap.set("new_surface", newSurface); app.handleRequest(actionMap); });
  11. 11. app.ask( app.buildRichResponse() .addSimpleResponse("<simple>") .addBasicCard( app.buildBasicCard("This is a **Basic Card** output.") .setTitle("Go to LINE app") .addButton("Launch", "https://server/launch_line.html") ) );
  12. 12. <!DOCTYPE html> <html lang="ja"> <head> <meta http-equiv="refresh" content="5;URL=line://nv/chat"> <meta charset="utf-8"> </head> <body> <p>Launch LINE App after 5 minutes.</p> </body> </html>
  13. 13. Conclusion Surface Capabilities ● AUDIO_OUTPUT and SCREEN_OUTPUT Check Methods ● hasSurfaceCapability ● hasAvailableSurfaceCapabilities Basic Card Rich Response with Link Button
  14. 14. Thanks!

×