Bixby Developer Center

Permissions

This sample capsule demonstrates how to set up, request, and use permissions on Bixby. The sample accesses the user's location and name.

Download Capsule

Note

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.

Using the Capsule

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:

  • "Start": Requests permissions from the user for the capsule's use, then displays the user's location with their name.
  • "Where am I": displays the user's location along with their name, as long as the requests were granted in the previous step.

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)
}

View 6d3ac5d on GitHub

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")
}
}

View 4cad14d on GitHub

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).

Video Tutorial: Capture User Location, Name, and More

The following video shows how to set up permissions to get certain user information with this sample capsule.