car/app/app/src/main/java/androidx/car/app/AppManager.java
/**
     * Shows an alert on the car screen.
     *
     * <p>Alerts with the same id, in the scope of the application, are considered equal. Even if
     * their content differ.</p>
     *
     * <p>Posting an alert while another alert is displayed would dismiss the old alert and replace
     * it with the new one.</p>
     *
     * <p>Only navigation templates support alerts. Triggering an alert while showing a
     * non-supported template results in the cancellation of the alert. </p>
     *
     * @param alert                 the alert to show
     * @throws HostException        if the remote call fails
     * @throws NullPointerException if {@code alert} is {@code null}
     */
Shows an alert on the car screen.
Alerts with the same id, in the scope of the application, are considered equal. Even if
their content differ.

Posting an alert while another alert is displayed would dismiss the old alert and replace
it with the new one.

Only navigation templates support alerts. Triggering an alert while showing a
non-supported template results in the cancellation of the alert.

@param alert                 the alert to show
@throws HostException        if the remote call fails
@throws NullPointerException if  alert is  null
Shows an alert on the car screen . Alerts with the same id in the scope of the application are considered equal . Even if their content differ . Posting an alert while another alert is displayed would dismiss the old alert and replace it with the new one . Only navigation templates support alerts . Triggering an alert while showing a non - supported template results in the cancellation of the alert . @param alert the alert to show @throws HostException if the remote call fails @throws NullPointerException if alert is null
@RequiresCarApi(5)
    public void showAlert(@NonNull Alert alert) {
        requireNonNull(alert);
        Bundleable bundle;
        try {
            bundle = Bundleable.create(alert);
        } catch (BundlerException e) {
            throw new IllegalArgumentException("Serialization failure", e);
        }
        mHostDispatcher.dispatch(
                CarContext.APP_SERVICE,
                "showAlert", (IAppHost host) -> {
                    host.showAlert(bundle);
                    return null;
                }
        );
    }
@ RequiresCarApi ( 5 ) public void showAlert ( @ NonNull Alert alert ) { requireNonNull ( alert ) ; Bundleable bundle ; try { bundle = Bundleable . create ( alert ) ; } catch ( BundlerException e ) { throw new IllegalArgumentException ( "Serialization failure" , e ) ; } mHostDispatcher . dispatch ( CarContext . APP_SERVICE , "showAlert" , ( IAppHost host ) -> { host . showAlert ( bundle ) ; return null ; } ) ; }
Shows an alert on the car screen.
Shows an alert on the car screen .