I am building an app that requires Device( Google Home/ Phone ) location. Do we need to request for permissions each time?
2 Answers
Unfortunately, yes. See Google Assistant location permissions not stored between requests
Where possible (ie - for the name) you should cache this against the UserId.
Clearly this isn't reasonable for location. I usually suggest coming up with a set of phrases to use to ask for location instead of just one to at least mitigate how frustrating it can be for the user.

- 49,922
- 7
- 53
- 105
-
For subsequent requests in the same session, I am storing the data. But for every new request ( beginning of the conversation ), I have to ask the user for his/her location which is quite annoying. – Harikiran Challa Sep 06 '17 at 01:28
-
Yes, it is annoying. Until/unless they change it, however, this is how it works. – Prisoner Sep 06 '17 at 05:05
Unlike mobile phone app permissions systems, there is no memory of if a user has previously granted your app a permission. So one option is to ask every time. A better option is to store the result in your backend for future use. However, you should avoid storing sensitive data (such as precise location) due to user privacy issues.
If, for example, you are wanting to store nearby train stations, you could ask for their location via the permission, query for nearby train stations using that location and then store the nearby train stations against their userId.

- 21,199
- 5
- 42
- 58
-
I don't see location persistence as a solution at all, as `Google Assistant` is available on phones as well, not just on `Google Home`. – Harikiran Challa Sep 06 '17 at 01:22
-
It depends on your use-case (wanting to know the user's home location or current location). Either way, your options are to store something and re-use, or ask each time if you need a fresh location. – AdamK Sep 06 '17 at 01:29
-
As the use-case require's user's current location, I might need to ask for permission every time. :( – Harikiran Challa Sep 07 '17 at 03:42
-
-
@AdamK can you help with this `api.ai` question: https://stackoverflow.com/q/46107516/6144372 Please? – Hammad Nasir Sep 09 '17 at 00:34