AppManager
public
class
AppManager
extends Object
java.lang.Object | |
↳ | androidx.car.app.AppManager |
Manages the communication between the app and the host.
Summary
Public methods | |
---|---|
void
|
invalidate()
Requests the current template to be invalidated, which eventually triggers a call to |
void
|
setSurfaceCallback(SurfaceCallback surfaceCallback)
Sets the |
void
|
showToast(CharSequence text, int duration)
Shows a toast on the car screen. |
Inherited methods | |
---|---|
Public methods
invalidate
public void invalidate ()
Requests the current template to be invalidated, which eventually triggers a call to Screen.onGetTemplate()
to get the new template to display.
Throws | |
---|---|
HostException |
if the remote call fails |
setSurfaceCallback
public void setSurfaceCallback (SurfaceCallback surfaceCallback)
Sets the SurfaceCallback
to get changes and updates to the surface on which the
app can draw custom content, or null
to reset the listener.
This call requires the androidx.car.app.ACCESS_SURFACE
permission to be declared.
The Surface
can be used to draw custom content such as a navigation app's map.
Note that the listener relates to UI events and will be executed on the main thread
using Looper.getMainLooper()
.
Parameters | |
---|---|
surfaceCallback |
SurfaceCallback |
Throws | |
---|---|
SecurityException |
if the app does not have the required permissions to access the surface |
HostException |
if the remote call fails |
showToast
public void showToast (CharSequence text, int duration)
Shows a toast on the car screen.
Parameters | |
---|---|
text |
CharSequence : the text to show |
duration |
int : how long to display the message |
Throws | |
---|---|
HostException |
if the remote call fails |
NullPointerException |
if text is null
|