1

I am trying to follow the below sample available on GitHub that explains how permissions work using the Node JS SDK:

https://github.com/actions-on-google/dialogflow-name-psychic-nodejs

I am noticing few strange things:

  1. When tested on the web simulator, the location always defaults to Mountain View, CA. Is that on purpose because the Google HQ is located there?

  2. When I invoke the same action on Google Home mini (I am logged into my Google account)

    2.1 I did not hear the reason why the permission was requested. From the logs, I can see that the request_location_permission action gets called but the conv.ask API call is not getting triggered.

    Code Snippet below:

    app.intent('request_location_permission', (conv) => {
      // If the request comes from a phone, we can't use coarse location.
      conv.data.requestedPermission =
        conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT')
        ? 'DEVICE_PRECISE_LOCATION'
        : 'DEVICE_COARSE_LOCATION';
    
      if (!conv.user.storage.location) {
        console.log('**inside the if condition');
        return conv.ask(new Permission({
          context: responses.permissionReason,
          permissions: conv.data.requestedPermission,
        }));
      }
      showLocationOnScreen(conv);
    });
    

    2.2 It ALWAYS defaults to permission denied (inside the handle_permission intent)

Here's the sequence of events on Google Home mini:

User-> Talk to my test app
Google Home-> bla..bla bla
User-> location
Google Home-> I can't read your mind
App Quits. 

But, what expected is that after I say "location", Google Home should ask for location permission, instead it reads out the error message.

Can anyone please shed some light on this.

Sai
  • 2,089
  • 3
  • 19
  • 30
  • When you say that the handler for the `request_location_permission` request is called - this is based on the "inside the if condition" message being logged, or something else? Is the "inside" message logged at all? – Prisoner Sep 11 '18 at 20:51
  • Also, if `conv.ask()` isn't getting triggered - how are you getting the `handle_permission` handler called? – Prisoner Sep 11 '18 at 20:52
  • Yes, I can see "Inside if condition" in Firebase logs. It's strange, I can see the log statement, so I am assuming that the conv.ask should also be executes, but I don't hear the prompt from conv.ask. – Sai Sep 11 '18 at 21:02

0 Answers0