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;








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










share|improve this question






























    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










    share|improve this question


























      0












      0








      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










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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






















          2 Answers
          2






          active

          oldest

          votes


















          1














          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();






          share|improve this answer























          • 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


















          0














          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






          share|improve this answer



























            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
            );



            );













            draft saved

            draft discarded


















            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









            1














            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();






            share|improve this answer























            • 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















            1














            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();






            share|improve this answer























            • 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













            1












            1








            1







            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();






            share|improve this answer













            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();







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • 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













            0














            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






            share|improve this answer





























              0














              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






              share|improve this answer



























                0












                0








                0







                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






                share|improve this answer















                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







                share|improve this answer














                share|improve this answer



                share|improve this answer








                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



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript