You cannot.
If you have a look at the following question: Develop an Android Auto custom app I have shared a jar which allows you to use some of the un-offical Android Auto SDK from there you can import this:
import com.google.android.apps.auto.sdk.CarToast;
import com.google.android.apps.auto.sdk.notification.CarNotificationExtender;
However even if you import the classes and use the CarToast like this:
CarToast.makeText(context,"SPEED CAMERA: " + text, Toast.LENGTH_LONG).show();
it will only display the toast on the phone screen not on the projected screen.
So to display a message correctly you will need to do something like this:
CarToast.makeText(context,"SPEED CAMERA: " + text, Toast.LENGTH_LONG).show();
CarNotificationExtender paramString2 = new CarNotificationExtender.Builder()
.setTitle(title)
.setSubtitle(text)
.setShouldShowAsHeadsUp(true)
.setActionIconResId(R.drawable.ic_danger_r)
.setBackgroundColor(Color.WHITE)
.setNightBackgroundColor(Color.DKGRAY)
.setThumbnail(bmp)
.build();
NotificationCompat.Builder mynot = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(text)
.setLargeIcon(bmp)
.setSmallIcon(R.drawable.ic_danger_r)
.setColor(Color.GRAY)
.extend(paramString2);
mNotifyMgr.notify(1983,mynot.build());
This will show a toast which will only be visible on the phone screen and it will show a heads-up notification which will only be visible on the car's screen. Since there is no action attached to it, nothing will happen if the use interacts with it the notification.
If the phone is connected to the car the phone's screen will be turned off anyway so displaying Toast there will be ignored.
The problem with all this is that since it's an unofficial jar and the SDK is not available to the public you won't be able to publish the app on PlayStore :(, that being said I only tried to publish complete apps, but an app which just display notification might pass through the filter.
<uses name="toast" />
for using the feature like this for toast – Wan