CarAppPermission
public
final
class
CarAppPermission
extends Object
java.lang.Object | |
↳ | androidx.car.app.CarAppPermission |
Defines all constants for permissions that a car app can use.
Summary
Constants | |
---|---|
String |
ACCESS_SURFACE
Permission that apps can use to get access to a canvas surface. |
String |
MAP_TEMPLATES
Permission that apps can use to get access to templates that show a map such as
|
String |
NAVIGATION_TEMPLATES
Permission that apps can use to get access to the navigation templates of the car app library. |
Public methods | |
---|---|
static
void
|
checkHasLibraryPermission(Context context, String permission)
Checks that the car app has declared the required library |
static
void
|
checkHasPermission(Context context, String permission)
Checks that the car app has the given |
Inherited methods | |
---|---|
Constants
ACCESS_SURFACE
public static final String ACCESS_SURFACE
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.
Constant Value: "androidx.car.app.ACCESS_SURFACE"
MAP_TEMPLATES
public static final String MAP_TEMPLATES
Permission that apps can use to get access to templates that show a map such as
PlaceListMapTemplate
. Templates used by navigation apps that
draw their own maps
(e.g. PlaceListNavigationTemplate
) don't require
this permission.
This permission can ONLY be requested by apps that declare themselves as a parking or charging app.
Constant Value: "androidx.car.app.MAP_TEMPLATES"
NAVIGATION_TEMPLATES
public static final String NAVIGATION_TEMPLATES
Permission that apps can use to get access to the navigation templates of the car app library.
This permission can ONLY be requested by apps that declare themselves as a navigation app.
See also:
Constant Value: "androidx.car.app.NAVIGATION_TEMPLATES"
Public methods
checkHasLibraryPermission
public static void checkHasLibraryPermission (Context context, String permission)
Checks that the car app has declared the required library permission
.
In contrast to checkHasPermission(Context, String)
, this method will validate that the app has at
least declared the permission requested.
Parameters | |
---|---|
context |
Context |
permission |
String |
Throws | |
---|---|
SecurityException |
if the app does not have the required permission declared |
checkHasPermission
public static void checkHasPermission (Context context, String permission)
Checks that the car app has the given permission
granted.
Parameters | |
---|---|
context |
Context |
permission |
String |
Throws | |
---|---|
SecurityException |
if the app does not have a required permission granted |