CarAppPermission
class CarAppPermission
Defines all constants for permissions that a car app can use.
Summary
Constants |
|
|---|---|
const String! |
ACCESS_SURFACE = "androidx.car.app.ACCESS_SURFACE"Permission that apps can use to get access to a canvas surface. |
const String! |
MAP_TEMPLATES = "androidx.car.app.MAP_TEMPLATES"Permission that apps can use to get access to templates that show a map such as |
const String! |
MEDIA_TEMPLATES = "androidx.car.app.MEDIA_TEMPLATES"Permission that apps can use to get access to the media templates of the car app library. |
const String! |
NAVIGATION_TEMPLATES = "androidx.car.app.NAVIGATION_TEMPLATES"Permission that apps can use to get access to the navigation templates of the car app library. |
Public functions |
|
|---|---|
java-static Unit |
checkHasLibraryPermission(context: Context, permission: String)Checks that the car app has declared the required library |
java-static Unit |
checkHasPermission(context: Context, permission: String)Checks that the car app has the given |
Constants
ACCESS_SURFACE
const val ACCESS_SURFACE = "androidx.car.app.ACCESS_SURFACE": String!
Permission that apps can use to get access to a canvas surface.
This surface can be used for drawing custom content like navigation apps can use it to draw a map.
MAP_TEMPLATES
const val MAP_TEMPLATES = "androidx.car.app.MAP_TEMPLATES": String!
Permission that apps can use to get access to templates that show a map such as androidx.car.app.model.PlaceListMapTemplate. Templates used by navigation apps that draw their own maps (e.g. androidx.car.app.navigation.model.PlaceListNavigationTemplate) don't require this permission.
This permission should only be declared by apps that belong to one of the categories that allow using the map templates. See the documentation for the list of such categories. An app not in one of those categories requesting this permission may be rejected upon submission. See CarAppService for how to declare your app's category.
MEDIA_TEMPLATES
const val MEDIA_TEMPLATES = "androidx.car.app.MEDIA_TEMPLATES": String!
Permission that apps can use to get access to the media templates of the car app library.
This permission should only be declared by apps that belong to one of the categories that allow using the media templates (e.g. MEDIA category). An app not in one of those categories requesting this permission may be rejected upon submission. See CarAppService for how to declare your app's category.
NAVIGATION_TEMPLATES
const val NAVIGATION_TEMPLATES = "androidx.car.app.NAVIGATION_TEMPLATES": String!
Permission that apps can use to get access to the navigation templates of the car app library.
This permission should only be declared by apps that belong to one of the categories that allow using the navigation templates. See the documentation for the list of such categories. An app not in one of those categories requesting this permission may be rejected upon submission. See CarAppService for how to declare your app's category.
Public functions
checkHasLibraryPermission
java-static fun checkHasLibraryPermission(context: Context, permission: String): Unit
Checks that the car app has declared the required library permission.
In contrast to checkHasPermission, this method will validate that the app has at least declared the permission requested.
| Throws | |
|---|---|
java.lang.SecurityException |
if the app does not have the required permission declared |
checkHasPermission
java-static fun checkHasPermission(context: Context, permission: String): Unit
Checks that the car app has the given permission granted.
| Throws | |
|---|---|
java.lang.SecurityException |
if the app does not have a required permission granted |