I'm developing a simple app with Google Assistant and API.AI. I would like to get access to user's location. According to documentation, I have to ask for a permission. But the documentation states it's only possible with a NodeJS client library. My webhook is in Java, can I do that somehow?
Asked
Active
Viewed 428 times
2 Answers
2
The Actions on Google client library for Node.js is a wrapper for the Actions Conversation Protocol: https://developers.google.com/actions/reference/conversation
For Java, you are free to implement support for the protocol in your code. Its mostly about accepting JSON payloads for your action and then creating a JSON response. Since the Node.js client library is open sourced, you should be able to figure out the logic that you need for your Java webhook.

Leon Nicholls
- 4,623
- 2
- 16
- 17
-
Thanks for you answer, it was helpful. I just read how API.AI webhook protocol is extended and added data for requesting the permission. But I'm now struggling with responding to user granting/denying permission. Assistant always answers "Sorry, to keep going, I need to get your street address from Google. Is that alright?" and my webhook is never triggered again. I have set outgoing context in permission request to "contextOut":["requesting_permission"]} and I have default fallback intent with this incoming context and fullfilment enabled. – David Vávra Dec 15 '16 at 15:29
-
That sound like the right steps. If you don't find a bug in your code, could you please email our [support team](https://developers.google.com/actions/support/) with relevant code samples and api.ai configuration? – Alfonso Gomez Jordana Manas Dec 15 '16 at 17:36
-
Thanks for the quick replies, I have contacted your support. – David Vávra Dec 15 '16 at 18:14
-
Can you create an answer here describing how did you solve it? I am too interested in getting the user location in Java. – Alexandros Ioannou Apr 16 '17 at 16:58
-
There is now an unofficial Java/kotlin Port of the SDK. It matches the nodejs api, so you can use the same docs. Available here https://github.com/TicketmasterMobileStudio/actions-on-google-kotlin – Patrick Jackson Aug 15 '17 at 12:38
1
Now there is an Unofficial Kolin/Java SDK for actions on google which will do everything that the offical SDK can do. The api is very similar, so the official examples and docs can assist you.
https://github.com/TicketmasterMobileStudio/actions-on-google-kotlin

Patrick Jackson
- 18,766
- 22
- 81
- 141