I'm developing an audio player application, and I need to determine when the user's device is connected to Android Auto.
The application features an alarm, and I want to make sure it doesn't go off while the user is driving.
To determine whether my music-service (MediaBrowserService
) works, I can use some flags in onCreate and onDestroy, or register reciver for "com.google.android.gms.car.media.STATUS" action - but it's a bad idea because alarm clock can trigger in any time. And not only when my music-service is running.
For alarm and I use AlarmManager
and pending intent.
Maybe someone faced with similar problems?