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:
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?
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.