我正在尝试使用复合卡中的点击密钥来打开谷歌地图,但我不知道要在app-launch的payload-URI键中包含什么。该文档使用已注释掉的示例,但我不知道该应用程序要填写什么(google-maps)。
我得到两个错误都是未知密钥message/app-launch
。
这是我们尝试使用的代码,因此当点击复合卡时,它会使用app-launch打开谷歌地图。
// PersonSelectionView.view.bxb
input-view {
match: Spot (this)
// optional selection dialog to overwrite any other default dialog
message (Pick a spot)
render {
// used to iterate over the list of candidates
selection-of (this) {
navigation-mode {
read-none {
list-summary ("There are #{size(this)} #{value(categories)} spots near you")
item-selection-question (Which one would you like?)
}
}
where-each (one) {
// you can use conditional logic to control how candidates are displayed,
// using either a standard layout with a match pattern, or a layout macro
compound-card {
content {
map-card {
title-area {
slot1 {
text {
value("#{value (one.spotName)}")
}
}
slot3 {
single-line {
text {
value("#{value (one.distance)} Miles away")
}
}
}
}
aspect-ratio (1:1)
markers {
marker {
geo ("Location.point")
icon {
template (/images/icons/red-marker.png)
}
width (15)
height (20)
anchor-x (5)
anchor-y (15)
rotation (0)
}
}
}
paragraph {
value {
template ("#{raw(description)}")
}
style (Detail_L)
}
}
on-click {
message ("TESTING THIS MESSAGE")
app-launch {
//payload-uri ("bixby://com.android.systemui/DummySystem/punchOut")
}
}
}
}
}
}
}
“未知密钥”错误意味着您尝试定义的密钥不是您当前所在密钥的有效子密钥之一.reference section的Bixby Developer Documentation为每个密钥提供其有效的子密钥。
app-launch
和message
都不是on-click
的子键。
app-launch
不能在on-click
中定义。它必须在自己的result-view
中定义。message
可以用多个键定义,但不能用on-click
定义你的on-click
需要重定向到一个单独的result-view
,其中包含app-launch
密钥和正确的payload-uri
定义。
您需要以下内容来实现您描述的行为:
result-view
与match
匹配概念示例操作:
action (LaunchDefinedUri) {
description (Launches the defined uri)
type (Commit)
collect {
input (launchUri) {
type (LaunchUri)
min (Required) max (One)
}
}
output (LaunchUri)
}
示例操作Javascript:
module.exports = {
function: LaunchDefinedUri
}
function LaunchDefinedUri(launchUri) {
return launchUri
}
示例概念:
text (LaunchUri) {
description (Uri to be launched)
}
示例结果视图:
result-view {
match: LaunchUri(this)
app-launch {
payload-uri("#{value(this)}")
}
render {
nothing
}
}
至于Google Maps API,Google Maps documentation似乎提供了有关如何为特定目的和行为定义正确URI的信息。
请查看Bixby团队提供的官方图书馆,该图书馆为Google地图提供了优质服务。
https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.navigation