Android: Google finally released a standalone Android Auto app, so you don't need an expensive head unit to use it. Now, you can use OK, Google to start voice commands while you're using it, whether you have the app or the head unit.
In the case of those using the app (which is likely most people), some phones could already use OK, Google if they had enabled hotword detection anywhere in the phone. However, the new update allows anyone to use the feature whenever Android Auto is open. It will also work for head units that are built into your car. You may need to update to the latest version of the Google app as well to make it work. The rollout is happening over time, so if you don't see it yet, just wait and it should arrive later.