Using Bixby Views and device-specific resources, your Bixby Capsule can be built to run on a variety of devices from phones to watches to televisions. This section lists some considerations to keep in mind.
Set Your Capsule's Targets
Your capsule's capsule.bxb
file should indicate all the devices your capsule can run on in its targets
block, specifying each pair of device type and language/locale.
capsule {
targets {
target (bixby-mobile-en)
target (bixby-mobile-kr)
target (bixby-watch-en)
target (bixby-watch-kr)
}
}
Implement Hands-Free and Eyes-Free Modes As Appropriate
All Bixby devices support Hands-Free List Navigation. Depending on the device and the situation, the user might only be able to use speech controls with Bixby. Your capsule should support appropriate navigation modes.
For more information on design considerations for multiple devices and hands-free operation, see the Hands-Free and Multiple Devices Design Guide.
Checking the Device Type in Your Code
Your capsule can determine what device it's running on at runtime:
In JavaScript action implementations, check the device
property in the $vivContext
user context structure passed to your action.
In Expression Language (used in *.bxb
files like dialog and views), check the $can.id
special EL variable.
In both cases, the return value will be a string such as bixby-mobile
or bixby-tv
, the same as the device targets used in the capsule.bxb
file (with no locale information).
You can use this information in conditionals to handle actions differently on different devices, or to use different dialog or layouts.
Tailor View Components for Specific Devices
While most Bixby Views components work across all supported devices, some components are limited to specific devices, or display differently on different devices. Consult the Views Supported by Device guide for details.
Often the same layouts can be used across all devices, but there might be contexts in which your capsule can deliver a better user experience by customizing views for a specific device. For example, when you are displaying a list of results, you might want to use image cards on devices with larger screens, but thumbnail cards on a watch to display content with smaller images.
Create Device-Specific Dialog
When it's appropriate, create dialog for different user experiences (such as touch-based vs. hands-free) and put them in the appropriate resource folders. As with layouts, the same dialog can often be used across all devices, but you might wish to customize prompts and responses for a specific device.
Use Macros for Reusable Text
To support multiple devices (and multiple locales) more easily, you can use macros in dialog and layouts. Macros allow you to reuse text in different contexts. For example, a macro could be used to repeat the same title-area
content in an image-card
on devices with larger screens and a thumbnail-card
on a watch.
Test Supported Devices in the Simulator
You can use the Device Simulator in Bixby Developer Studio to test your capsule in simulated versions of a variety of devices. The device simulator will display view components as they would display on the selected device, so it's easy to see whether you should consider tweaking the layouts for different device screen sizes and capabilities.
If the device you want to test isn't available to choose in the Simulator, make sure you've declared it as a target in the capsule's capsule.bxb
file.