Bixby : how to get informations based on my location? such as weather etc

假装没事ソ 提交于 2020-02-02 05:01:17

问题


I saw the dev guide of bixby studio and tested provided samples.

I want to some more complex (but very important) service such as the weather info based on my location.

Is this feature available in the current state of bixby studio? If possible, let me know how.


回答1:


Here is a snippet of code that might help you. Be sure to import the viv.geo library in your capsule.bxb file

import (viv.geo) { as (geo) version (9.0.6) } The latest version of capsule libraries is available here: https://bixbydevelopers.com/dev/docs/dev-guide/developers/library#capsule-versions

And the following code in your Action

 input (myLocation) {
       min (Required) max(One)
       type (geo.NamedPoint)

       default-init {
         if ($user.currentLocation.$exists) {
           intent {
             goal: geo.NamedPoint
             value-set: geo.CurrentLocation { $expr ($user.currentLocation) }
           }
         } 
       }
     }



回答2:


If you want to get the information based on your current location - you may use $user.currrentLocation while modelling Actions. It returns GeoPoint type data you can use further. If you use the simulator - it can be customized on "User" tab (Ctrl + 2)



来源:https://stackoverflow.com/questions/53734621/bixby-how-to-get-informations-based-on-my-location-such-as-weather-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!