You can not.
If you look at the following question: Developing a custom Android Auto application I shared a jar that allows you to use some of the non-standard Android Auto SDKs 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 classes and use CarToast as follows:
CarToast.makeText(context,"SPEED CAMERA: " + text, Toast.LENGTH_LONG).show();
it will display a toast on the phone screen not on the projected screen.
So, in order to correctly display the message, 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 that will only be displayed on the phoneβs screen, and it will display a heads-up notification that will only appear on the carβs screen. Since no action is taken with it, nothing will happen if the use interacts with it with a notification.
If the phone is connected to the car, the phone screen will be turned off, so the Toast display will be ignored.
The problem with all this is that since the unofficial bank and SDK are not accessible to the public, you will not be able to publish the application on the PlayStore :( that, as they say, I was only trying to publish full applications, but an application that only displays a notification may pass through the filter.