我正在尝试使用复合卡上的单击键打开google地图,但是我不知道要在应用程序启动的有效负载URI密钥中包含什么。该文档使用已注释掉的示例,但我不知道该应用程序要填写什么内容(谷歌地图)。
我遇到两个错误,都是未知密钥message/app-launch
。
这是我们尝试使用的代码,因此,当单击复合卡时,它将打开带有应用启动功能的Google地图。
// 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")
}
}
}
}
}
}
}
答案 0 :(得分:3)
“未知密钥”错误表示您试图定义的密钥不是当前所在密钥的有效子密钥之一。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
的{{1}}键。
您需要以下各项来实现您描述的行为:
payload-uri
与概念匹配的result-view
示例操作:
match
动作Java脚本示例:
action (LaunchDefinedUri) {
description (Launches the defined uri)
type (Commit)
collect {
input (launchUri) {
type (LaunchUri)
min (Required) max (One)
}
}
output (LaunchUri)
}
示例概念:
module.exports = {
function: LaunchDefinedUri
}
function LaunchDefinedUri(launchUri) {
return launchUri
}
示例结果视图:
text (LaunchUri) {
description (Uri to be launched)
}
特别是对于Google Maps API,Google Maps documentation似乎提供了有关如何根据您的特定目的和行为定义正确的URI的信息。
答案 1 :(得分:1)
请查看由Bixby团队提供的官方图书馆,该图书馆提供对Google Maps的深入了解。
https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.navigation