CarPendingIntent
public final class CarPendingIntent
A class which creates PendingIntents that will start a car app, to be used in a notification action.
Summary
Public methods |
|
|---|---|
static @NonNull PendingIntent |
Creates a |
Public methods
getCarApp
public static @NonNull PendingIntent getCarApp(
@NonNull Context context,
int requestCode,
@NonNull Intent intent,
int flags
)
Creates a PendingIntent that can be sent in a notification action which will allow the targeted car app to be started when the user clicks on the action.
See startCarApp for the supported intents that can be passed to this method.
Here is an example of usage of this method when setting a notification's intent:
NotificationCompat.Builder builder;
...
builder.setContentIntent(CarPendingIntent.getCarApp(getCarContext(), 0,
new Intent(Intent.ACTION_VIEW).setComponent(
new ComponentName(getCarContext(), MyCarAppService.class)), 0));| Parameters | |
|---|---|
@NonNull Context context |
the context in which this PendingIntent should use to start the car app |
int requestCode |
private request code for the sender |
@NonNull Intent intent |
the intent that will be sent to the car app |
int flags |
may be any of the flags allowed by |
| Returns | |
|---|---|
@NonNull PendingIntent |
an existing or new PendingIntent matching the given parameters. May return |
| Throws | |
|---|---|
java.lang.NullPointerException |
if either |
java.security.InvalidParameterException |
if the |
java.lang.SecurityException |
if the |