Anurag-Sharma
Anurag-Sharma

Reputation: 4398

Unable to accept the permission prompt on Actions on Google

I am trying to get permissions for location and name for my app.
Here is my index.js - link

It seems to be stuck in a loop :- enter image description here

Here are my intents on API.AI :- enter image description here enter image description here

Upvotes: 2

Views: 532

Answers (1)

Prisoner
Prisoner

Reputation: 50701

The event actions_intent_PERMISSION needs to be attached to an Intent that will be called after the user authorizes the information to be sent. The handling for it in the webhook needs to read the information given and save it or do something with it immediately.

Your code is looping because the code that is processing the request_permission action is, itself, requesting permission:

function requestPermission(app){
    const permissions = [
      app.SupportedPermissions.NAME,
      app.SupportedPermissions.DEVICE_PRECISE_LOCATION
    ];
    app.askForPermissions('To pick you up', permissions);
}

So you will need:

  • A new intent
  • that has actions_intent_PERMISSION set for the event
  • that has a new action string associated with it
  • and maps to a new function that handles the information that the user has consented to.

Upvotes: 6

Related Questions