CarAppActivity
class CarAppActivity : BaseCarAppActivity
The class representing a car app activity in the main display.
This class is responsible for binding to the host and rendering the content given by its androidx.car.app.CarAppService.
Usage of CarAppActivity is only required for applications targeting Automotive OS.
The app must declare and export this CarAppActivity in their manifest. In order for it to show up in the car's app launcher. It must declare the launchMode to be singleTask, and it must include a CATEGORY_LAUNCHER intent filter. For example:
<activity android:name="androidx.car.app.activity.CarAppActivity" android:exported="true" android:launchMode="singleTask" android:label="@string/your_app_label"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="distractionOptimized" android:value="true"/> </activity>
See androidx.car.app.CarAppService for how to declare your app's CarAppService in the manifest.
The activity must be the distractionOptimized meta-data set to true, in order for it to be displayed while driving. This is the only activity that can have this meta-data set to true, any other activities marked this way may cause the app to be rejected during app submission.
Summary
Public constructors |
|---|
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Inherited properties |
||
|---|---|---|
|
Public constructors
Protected functions
onCreate
protected fun onCreate(savedInstanceState: Bundle?): Unit
{@inheritDoc}
If your ComponentActivity is annotated with ContentView, this will call setContentView for you.