1

My Dialogflow app calls app.askForPermission() to have the user grant permission so that my app can get his location.

Do I need to ask the user for this permission every time he launches the app? I am hoping I only need to ask a given user once.

Josh Grinberg
  • 523
  • 6
  • 14
  • Possible duplicate of [Google Assistant location permissions not stored between requests](https://stackoverflow.com/questions/45044623/google-assistant-location-permissions-not-stored-between-requests) – Prisoner Mar 19 '18 at 09:55
  • Possible duplicate of [Save granted permissions across conversations in a Actions on Google app](https://stackoverflow.com/questions/47486887/save-granted-permissions-across-conversations-in-a-actions-on-google-app) – jb. Jan 31 '19 at 13:37

1 Answers1

2

Currently, yes you will need to request the permission each time you want to access that value. However, you can cache the result that you get between steps of a conversation using the JSON object app.data. You can also cache the result that you get between sessions using the JSON object app.userStorage. In these cases you should make sure the user is aware that you are caching this data in your app and in your privacy policy.

app.userStorage.lastLocation = <location result>

Then you can use it the next time the user starts your app.

This can be not ideal in certain circumstances depending on the use case of the app and the level of granularity you are seeking.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35