This sample capsule demonstrates how to set up, request, and use permissions on Bixby. The sample accesses the user's location and name.
Because you cannot submit a capsule with the example namespace, in order to test a sample capsule on a device, you must change the id in the capsule.bxb file from example to your organization's namespace before making a private submission.
For example, if your namespace is acme, change example.permissions to acme.permissions.
To start the demonstration, load the capsule, open the Device Simulator, and say (or type) the utterance "Start". The capsule is trained with two examples:
The permissions for the capsule are requested in the capsule.bxb file, in the permissions block:
permissions {
// This capsule uses device-location-access to get the user's location
// and self:profile to get the users name
device-location-access
library-permission (self:profile)
}
This requests access to the device's location data with device-location-access, and asks for the library-permission of self:profile, which specifically requests access to the user's profile data through the viv.self library.
In addition, the capsule-info.bxb file has a requested-permissions block that lets the user know what permissions the capsule is requesting and why it needs them:
requested-permissions {
permission (device-location-access) {
justification ("This capsule needs your permission to get your device location")
}
permission (self:profile){
justification ("This capsule needs permission to get your name")
}
}
You can examine the rest of the capsule's code to see its functionality. It contains only one concept (MyInfo, for the user's name and location) and one action (GetLocationAndProfile, which uses default-init to get the user's location and name and construct a MyInfo concept from them).
The following video shows how to set up permissions to get certain user information with this sample capsule.