public final class CarAppActivity
extends FragmentActivity

   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
           ↳ androidx.activity.ComponentActivity

The class representing a car app activity.

This class is responsible for binding to the host and rendering the content given by its CarAppService.

Usage of CarAppActivity is only required for applications targeting Automotive OS.

Activity Declaration

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 include a Intent.CATEGORY_LAUNCHER intent filter. For example:


     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
   <meta-data android:name="distractionOptimized" android:value="true"/>

See CarAppService for how to declare your app's CarAppService in the manifest.

Distraction-optimized Activities

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.


Inherited constants

Inherited fields

Public constructors


Public methods

void onBackPressed()

Called when the activity has detected the user's press of the back key.

Protected methods

void onCreate(Bundle savedInstanceState)

If your ComponentActivity is annotated with ContentView, this will call setContentView(int) for you. Perform initialization of all fragments.

void onDestroy()

Destroy all fragments.

void onNewIntent(Intent intent)

Handle onNewIntent() to inform the fragment manager that the state is not saved.

Inherited methods