How to I save some data into userStorage in the Java/Kotlin Client Library for Actions on GoogleHow to convert a kotlin source file to a java source fileCan I import a library write in Kotlin to my android project (uses java)How to use a reusable library in kotlin, with android and javascript?Kotlin to Java (Library Help)kotlin-room cannot figure out how to save this fieldUsing Kotlin libraries as dependencies in a Java projectSave data in userStorage outside the Google Assistantusing a java 9 compiled library in KotlinAndroid - gRPC client - From Java to KotlinHow to save ArayList data into Firebase Using kotlin?
Why is a dedicated QA team member necessary?
How do campaign rallies gain candidates votes?
What are the exact meanings of roll, pitch and yaw?
Can two figures have the same area, perimeter, and same number of segments have different shape?
What do I do when a student working in my lab "ghosts" me?
How do professional electronic musicians/sound engineers combat listening fatigue?
Invert Some Switches on a Switchboard
Is my employer paying me fairly? Going from 1099 to W2
powerhouse of ideas
How important is a good quality camera for good photography?
How do I run a game when my PCs have different approaches to combat?
What is the difference between 1/3, 1/2, and full casters?
A fictional island on Earth with "longer" springs and autumns
The seven story archetypes. Are they truly all of them?
Why is my read in of data taking so long?
Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?
TSA asking to see cell phone
USA: Can a witness take the 5th to avoid perjury?
How may I concisely assign different values to a variable, depending on another variable?
How is the uk visa 180 calculated
How to copy a file transactionally?
How did C64 games handle music during gameplay?
Grid/table with lots of buttons
Why no ";" after "do" in sh loops?
How to I save some data into userStorage in the Java/Kotlin Client Library for Actions on Google
How to convert a kotlin source file to a java source fileCan I import a library write in Kotlin to my android project (uses java)How to use a reusable library in kotlin, with android and javascript?Kotlin to Java (Library Help)kotlin-room cannot figure out how to save this fieldUsing Kotlin libraries as dependencies in a Java projectSave data in userStorage outside the Google Assistantusing a java 9 compiled library in KotlinAndroid - gRPC client - From Java to KotlinHow to save ArayList data into Firebase Using kotlin?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to save some info in the userStorage in Kotlin
In javascript, I did the following
exports.saveFloor = (conv, floor) =>
conv.user.storage.floor = floor;
here is the client library
kotlin actions-on-google
add a comment |
I am trying to save some info in the userStorage in Kotlin
In javascript, I did the following
exports.saveFloor = (conv, floor) =>
conv.user.storage.floor = floor;
here is the client library
kotlin actions-on-google
add a comment |
I am trying to save some info in the userStorage in Kotlin
In javascript, I did the following
exports.saveFloor = (conv, floor) =>
conv.user.storage.floor = floor;
here is the client library
kotlin actions-on-google
I am trying to save some info in the userStorage in Kotlin
In javascript, I did the following
exports.saveFloor = (conv, floor) =>
conv.user.storage.floor = floor;
here is the client library
kotlin actions-on-google
kotlin actions-on-google
edited Mar 27 at 16:30
Chris
asked Mar 26 at 16:46
ChrisChris
7961 gold badge8 silver badges13 bronze badges
7961 gold badge8 silver badges13 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
From Name Psychic:
@ForIntent("request_name_permission")
public ActionResponse requestNamePermission(ActionRequest request)
ResponseBuilder response = getResponseBuilder(request);
String requestedPermission = ConstantsKt.PERMISSION_NAME;
response.getConversationData().put(DATA_KEY_REQUESTED_PERMISSION, requestedPermission);
String storageKey = STORAGE_KEY_NAME;
if (!request.getUserStorage().containsKey(storageKey))
Permission permission =
new Permission()
.setContext(formatResponse("permission_reason"))
.setPermissions(new String[] requestedPermission);
response.add("PLACEHOLDER_FOR_PERMISSION");
response.add(permission);
else
String name = (String) request.getUserStorage().get(storageKey);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
add a comment |
I guess the snippet I was looking for is
Map<String, Object> storage = response.getUserStorage();
String requestedPermission =
(String) request.getConversationData().get(DATA_KEY_REQUESTED_PERMISSION);
if (requestedPermission.equals(ConstantsKt.PERMISSION_NAME))
String name = request.getUser().getProfile().getDisplayName();
storage.put(STORAGE_KEY_NAME, name);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
if (requestedPermission.equals(ConstantsKt.PERMISSION_DEVICE_COARSE_LOCATION))
String location = request.getDevice().getLocation().getCity();
storage.put(STORAGE_KEY_LOCATION, location);
showLocationOnScreen(request, response);
return response.build();
The equivalent of my javascript code into Kotlin would be
fun saveFloor(request: ActionRequest, floor: String)
val response = getResponseBuilder(request)
val storage = response.userStorage as MutableMap
storage["floor"] = floor
Cheers to Nick for pointing me in the right direction
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362300%2fhow-to-i-save-some-data-into-userstorage-in-the-java-kotlin-client-library-for-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
From Name Psychic:
@ForIntent("request_name_permission")
public ActionResponse requestNamePermission(ActionRequest request)
ResponseBuilder response = getResponseBuilder(request);
String requestedPermission = ConstantsKt.PERMISSION_NAME;
response.getConversationData().put(DATA_KEY_REQUESTED_PERMISSION, requestedPermission);
String storageKey = STORAGE_KEY_NAME;
if (!request.getUserStorage().containsKey(storageKey))
Permission permission =
new Permission()
.setContext(formatResponse("permission_reason"))
.setPermissions(new String[] requestedPermission);
response.add("PLACEHOLDER_FOR_PERMISSION");
response.add(permission);
else
String name = (String) request.getUserStorage().get(storageKey);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
add a comment |
From Name Psychic:
@ForIntent("request_name_permission")
public ActionResponse requestNamePermission(ActionRequest request)
ResponseBuilder response = getResponseBuilder(request);
String requestedPermission = ConstantsKt.PERMISSION_NAME;
response.getConversationData().put(DATA_KEY_REQUESTED_PERMISSION, requestedPermission);
String storageKey = STORAGE_KEY_NAME;
if (!request.getUserStorage().containsKey(storageKey))
Permission permission =
new Permission()
.setContext(formatResponse("permission_reason"))
.setPermissions(new String[] requestedPermission);
response.add("PLACEHOLDER_FOR_PERMISSION");
response.add(permission);
else
String name = (String) request.getUserStorage().get(storageKey);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
add a comment |
From Name Psychic:
@ForIntent("request_name_permission")
public ActionResponse requestNamePermission(ActionRequest request)
ResponseBuilder response = getResponseBuilder(request);
String requestedPermission = ConstantsKt.PERMISSION_NAME;
response.getConversationData().put(DATA_KEY_REQUESTED_PERMISSION, requestedPermission);
String storageKey = STORAGE_KEY_NAME;
if (!request.getUserStorage().containsKey(storageKey))
Permission permission =
new Permission()
.setContext(formatResponse("permission_reason"))
.setPermissions(new String[] requestedPermission);
response.add("PLACEHOLDER_FOR_PERMISSION");
response.add(permission);
else
String name = (String) request.getUserStorage().get(storageKey);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
From Name Psychic:
@ForIntent("request_name_permission")
public ActionResponse requestNamePermission(ActionRequest request)
ResponseBuilder response = getResponseBuilder(request);
String requestedPermission = ConstantsKt.PERMISSION_NAME;
response.getConversationData().put(DATA_KEY_REQUESTED_PERMISSION, requestedPermission);
String storageKey = STORAGE_KEY_NAME;
if (!request.getUserStorage().containsKey(storageKey))
Permission permission =
new Permission()
.setContext(formatResponse("permission_reason"))
.setPermissions(new String[] requestedPermission);
response.add("PLACEHOLDER_FOR_PERMISSION");
response.add(permission);
else
String name = (String) request.getUserStorage().get(storageKey);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
answered Mar 26 at 19:46
Nick FelkerNick Felker
7,4421 gold badge11 silver badges22 bronze badges
7,4421 gold badge11 silver badges22 bronze badges
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
add a comment |
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
Correct me if I m wrong, isn't this demonstrating how to retrieve a value from the UserStorage instead of saving it ?
– Chris
Mar 27 at 10:52
add a comment |
I guess the snippet I was looking for is
Map<String, Object> storage = response.getUserStorage();
String requestedPermission =
(String) request.getConversationData().get(DATA_KEY_REQUESTED_PERMISSION);
if (requestedPermission.equals(ConstantsKt.PERMISSION_NAME))
String name = request.getUser().getProfile().getDisplayName();
storage.put(STORAGE_KEY_NAME, name);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
if (requestedPermission.equals(ConstantsKt.PERMISSION_DEVICE_COARSE_LOCATION))
String location = request.getDevice().getLocation().getCity();
storage.put(STORAGE_KEY_LOCATION, location);
showLocationOnScreen(request, response);
return response.build();
The equivalent of my javascript code into Kotlin would be
fun saveFloor(request: ActionRequest, floor: String)
val response = getResponseBuilder(request)
val storage = response.userStorage as MutableMap
storage["floor"] = floor
Cheers to Nick for pointing me in the right direction
add a comment |
I guess the snippet I was looking for is
Map<String, Object> storage = response.getUserStorage();
String requestedPermission =
(String) request.getConversationData().get(DATA_KEY_REQUESTED_PERMISSION);
if (requestedPermission.equals(ConstantsKt.PERMISSION_NAME))
String name = request.getUser().getProfile().getDisplayName();
storage.put(STORAGE_KEY_NAME, name);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
if (requestedPermission.equals(ConstantsKt.PERMISSION_DEVICE_COARSE_LOCATION))
String location = request.getDevice().getLocation().getCity();
storage.put(STORAGE_KEY_LOCATION, location);
showLocationOnScreen(request, response);
return response.build();
The equivalent of my javascript code into Kotlin would be
fun saveFloor(request: ActionRequest, floor: String)
val response = getResponseBuilder(request)
val storage = response.userStorage as MutableMap
storage["floor"] = floor
Cheers to Nick for pointing me in the right direction
add a comment |
I guess the snippet I was looking for is
Map<String, Object> storage = response.getUserStorage();
String requestedPermission =
(String) request.getConversationData().get(DATA_KEY_REQUESTED_PERMISSION);
if (requestedPermission.equals(ConstantsKt.PERMISSION_NAME))
String name = request.getUser().getProfile().getDisplayName();
storage.put(STORAGE_KEY_NAME, name);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
if (requestedPermission.equals(ConstantsKt.PERMISSION_DEVICE_COARSE_LOCATION))
String location = request.getDevice().getLocation().getCity();
storage.put(STORAGE_KEY_LOCATION, location);
showLocationOnScreen(request, response);
return response.build();
The equivalent of my javascript code into Kotlin would be
fun saveFloor(request: ActionRequest, floor: String)
val response = getResponseBuilder(request)
val storage = response.userStorage as MutableMap
storage["floor"] = floor
Cheers to Nick for pointing me in the right direction
I guess the snippet I was looking for is
Map<String, Object> storage = response.getUserStorage();
String requestedPermission =
(String) request.getConversationData().get(DATA_KEY_REQUESTED_PERMISSION);
if (requestedPermission.equals(ConstantsKt.PERMISSION_NAME))
String name = request.getUser().getProfile().getDisplayName();
storage.put(STORAGE_KEY_NAME, name);
response.add(formatResponse("say_name", name));
response.endConversation();
return response.build();
if (requestedPermission.equals(ConstantsKt.PERMISSION_DEVICE_COARSE_LOCATION))
String location = request.getDevice().getLocation().getCity();
storage.put(STORAGE_KEY_LOCATION, location);
showLocationOnScreen(request, response);
return response.build();
The equivalent of my javascript code into Kotlin would be
fun saveFloor(request: ActionRequest, floor: String)
val response = getResponseBuilder(request)
val storage = response.userStorage as MutableMap
storage["floor"] = floor
Cheers to Nick for pointing me in the right direction
edited Mar 27 at 15:18
answered Mar 27 at 10:56
ChrisChris
7961 gold badge8 silver badges13 bronze badges
7961 gold badge8 silver badges13 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362300%2fhow-to-i-save-some-data-into-userstorage-in-the-java-kotlin-client-library-for-a%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown