I used Mazda AIO Tweaks to get Android Auto support (along with other changes) in my 2017 Mazda 3. I am pretty sure they support older/other models as well. Very easy, took about 20 minutes from downloading to updating the car.
In addition, if they find you've tweaked the software, they won't honor any warranty claims concerning the infotainment system.