This section describes how to use Bixby's library capsules, which let your capsules work with complex concepts such as dates, times, and geography.
To use a library capsule, it must be imported. In your capsule.bxb
file, include an import
statement in the capsule-imports
block:
capsule {
capsule-imports {
import (viv.time) {
as (time) version (2.58.56)
}
}
}
This import lets you refer to concepts and actions in the viv.time.*
namespace simply with time.*
.
Capsules import their own dependencies (for example, viv.contact
relies on viv.geo
, viv.time
, and other library capsules); your capsule does not need to import these separately.
Last updated November 13, 2019
When importing library capsules, these are the current versions to specify:
Library Capsule | Version |
---|---|
bixby.audioPlayer | 1.0.1 |
viv.common | 4.0.0 |
viv.contact | 2.5156.4 |
viv.entity | 4.0.1 |
viv.geo | 9.23.0 |
viv.image | 2.12.10 |
viv.location | 1.0.23 |
viv.measurement | 2.14.7 |
viv.money | 2.22.20 |
viv.navigation | 1.9.23 |
viv.openHours | 4.1.18 |
viv.rating | 3.2.11 |
viv.self | 3.5.167 |
viv.shareVia | 0.4019.11 |
viv.time | 3.0.52 |
Instead of indicating a version for each imported capsule, once you import a library, you can use version-from
to transitively import any of its dependencies. This is useful in order to keep versions aligned and prevent your capsule dependency chain from using two different versions of the same imported capsule.
Because of the transitive nature of version-from
, you only have to point to a capsule that indirectly imports that capsule. Take, for example, the following diagram, that shows various capsule dependencies for each of the library capsules shown above:
In the example below, the capsule first specifies the version when importing viv.entity
. It then uses the capsule to get capsule versions for other imported capsules, such as viv.common
and viv.time
.
capsule {
id (example.spaceResorts)
version (1.0.0)
format (3)
targets {
target (bixby-mobile-en-US)
target (bixby-mobile-ko-KR)
}
capsule-imports {
import (viv.core) {
as (core)
}
import (viv.entity) {
as (entity)
version (3.14.9)
}
import (viv.common) {
as (common)
version-from (entity)
}
import (viv.time) {
as (time)
version-from (entity)
}
import (viv.money) {
as (money)
version (2.18.9)
}
import (bixby.profile) {
as (profile)
version (1.0.0)
}
}
}
These are some of the most commonly used library capsules along with links to further discussion.
Audio Player (bixby.audioPlayer
)
Describes how to use the AudioPlayer library to play audio streams within Bixby, without relying on erxternal player applications.
Contact (viv.contact
)
Describes how to search for and save contact information.
Core (viv.core
)
A low-level capsule that defines concepts used by other library capsules.
DateTime (viv.time
)
Describes how to work with a variety of relative and absolute date/time expressions.
Entity (viv.entity
)
Providers helper models, layout macros, and dialogs for presenting certain kinds of data sets.
Geography (viv.geo
)
Describes how to work with geospatial concepts and localities.
Image (viv.image
)
Describes how to work with concepts representing image metadata.
Location (viv.location
)
Describes how to use the location/contact-based autosuggest library.
Measurement (viv.measurement
)
Describes how to work with concepts representing units of measurement, including conversion between compatible units.
Money (viv.money
)
Describes how to work with currency.
Navigation (viv.navigation
)
Describes how to provide navigation to a selected destination with Google Maps.
Open Hours (viv.openHours
)
Describes a set of concepts representing open hours for businesses.
Profile (viv.self
)
Describes how to access and update user profile information.
Rating (viv.rating
)
Describes how to work with concepts representing ratings and reviews.
Sharing (viv.sharevia
)
Describes how to send content to other applications or capsules.