public class Place implements HelperIntent
Helper intent response to request user to provide a geo-located place, possibly using contextual information, like a store near the user's location or a contact's address.
Developer provides custom text prompts to tailor the request handled by Google.
@ForIntent("askForPlace")
public CompletableFuture askForPlace(ActionRequest request) {
ResponseBuilder responseBuilder = getResponseBuilder();
responseBuilder
.add("Placeholder for place text")
.add(new Place()
.setRequestPrompt("Where do you want to have lunch?"),
.setPermissionContext("To find lunch locations"));
return CompletableFuture.completedFuture(responseBuilder.build());
}
@ForIntent("actions_intent_place")
public CompletableFuture handlePlaceResponse(ActionRequest request) {
ResponseBuilder responseBuilder = getResponseBuilder();
Location location = request.getPlace();
String response;
if (location != null) {
response = " Suggested place - " + getLocationString(location);
} else {
response = "Unable to find any lunch locations";
}
responseBuilder.add(response);
return CompletableFuture.completedFuture(responseBuilder.build());
}
Constructor and Description |
---|
Place()
Helper intent response to request user to provide a geo-located place,
possibly using contextual information, like a store near the user's location
or a contact's address.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
java.util.Map<java.lang.String,java.lang.Object> |
getParameters() |
Place |
setPermissionContext(java.lang.String permissionContext) |
Place |
setRequestPrompt(java.lang.String requestPrompt) |
getName, getParameters
public Place()
Helper intent response to request user to provide a geo-located place, possibly using contextual information, like a store near the user's location or a contact's address.
Developer provides custom text prompts to tailor the request handled by Google.
@ForIntent("askForPlace")
public CompletableFuture askForPlace(ActionRequest request) {
ResponseBuilder responseBuilder = getResponseBuilder();
responseBuilder
.add("Placeholder for place text")
.add(new Place()
.setRequestPrompt("Where do you want to have lunch?"),
.setPermissionContext("To find lunch locations"));
return CompletableFuture.completedFuture(responseBuilder.build());
}
@ForIntent("actions_intent_place")
public CompletableFuture handlePlaceResponse(ActionRequest request) {
ResponseBuilder responseBuilder = getResponseBuilder();
Location location = request.getPlace();
String response;
if (location != null) {
response = " Suggested place - " + getLocationString(location);
} else {
response = "Unable to find any lunch locations";
}
responseBuilder.add(response);
return CompletableFuture.completedFuture(responseBuilder.build());
}
public Place setRequestPrompt(java.lang.String requestPrompt)
public Place setPermissionContext(java.lang.String permissionContext)
public java.lang.String getName()
public java.util.Map<java.lang.String,java.lang.Object> getParameters()