audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

[doc: Android Auto] How call your Android Now Playing action / template ?

Open EArminjon opened this issue 3 months ago • 7 comments

Documentation link

https://pub.dev/packages/audio_service

Your suggestion

I’m adding Flutter Android Auto support to the flutter_carplay package in this PR, and I’d like to provide documentation for Android Auto media apps.

By default, your package enables basic Android Auto support by exposing an action and a view: when the user selects the app on their Android Auto device, a Now Playing template is displayed.

For developers who want to build a custom Android Auto experience with multiple templates, how can they reuse the default Android Auto Now Playing template? How should they call it?

With my PR, when music is playing and the user clicks on it, the app opens on Android Auto, but the user is not taken directly to the Now Playing template.

EArminjon avatar Sep 29 '25 19:09 EArminjon

For the moment i'm unable to make an app use both audio_service and flutter_carplay to offer a custom UI experience.

For Android support i'm stuck with your BaseAudioHandler class and its getChildren method (responsable of ListTemplate/GridTemplate items. For those who are curious, you can react to user click with BaseAudioHandler.playFromMediaId.

EArminjon avatar Oct 04 '25 15:10 EArminjon

Hey @EArminjon Appreciate your effort for combining the android auto + flutter_carplay.

I’m developing Android Auto and CarPlay support with flutter_carplay, integrated alongside audio_service. Currently, I already have an app that streams music online/offline using audio_service, and the new requirement includes:

  1. Browsing multiple lists (caches implemented)
  2. Refreshing lists based on Auto/CarPlay events (same time data refresh not working if there is new update on mobile app version)
  3. Running the Android auto and iOS Carplay individually without launching the app in mobile device.
  4. Managing and syncing a manually maintained local queue with the mobile version

I’ve implemented Android Auto using getChildren() and playFromMediaId ( but playback is unstable and inbuilt android auto queue methods are not working as intended) and CarPlay natively via method channels (more stable).

My question: Can I use your PR code that adds Android Auto + CarPlay support with audio_service for these use cases, or should I wait for further updates before integrating it?

Also, It would be helpful if you can share some demo code which combines (audio_service + flutter_carplay + android_auto) or give guidance how to handle that ?

Thanks.

kcs-govindtank avatar Nov 05 '25 13:11 kcs-govindtank

Actually, the audio_service package provides an opinionated and limited support for Android Auto. The documentation isn’t very explicit, but once you figure out how it works, it’s great.

However, I’d like to go deeper into Android Auto integration, which is why I’m trying to link audio_service with a custom Android Auto implementation. Currently, I’m facing issues making the “Right Now Template” accessible, possibly because audio_session / audio_service have trouble communicating with my custom implementation.

@ryanheise do you have any advices ?

EArminjon avatar Nov 09 '25 09:11 EArminjon

My intention was to expose all of the relevant APIs related to Android Auto, so that if you just follow Android's own documentation on how to set up Android Auto, you should be able to find the equivalent in audio_service to carry out every step. If you report anything missing from audio_service needed for AA, I'll add it.

ryanheise avatar Nov 09 '25 09:11 ryanheise

@EArminjon I tried your code, there are some methods which is useful which i have manually tried to implement but failed like refreshing the root tab content as per need. I hope you push new changes soon, on the iOS Carplay you have more template than android auto, which is very useful, similar for the Android auto i wish the development might improvise that we can rely on that.

@ryanheise I hope we can have some version of official package which combines audio_service package with android auto and ios carplay (of flutter_carplay) with example as support. as many like us looking forward to explore the package further.

Kudos to both of you @EArminjon @ryanheise working on this amazing packages.

kcs-govindtank avatar Nov 10 '25 06:11 kcs-govindtank

@ryanheise I hope we can have some version of official package which combines audio_service package with android auto and ios carplay (of flutter_carplay) with example as support. as many like us looking forward to explore the package further.

I would definitely want audio_service to fully support CarPlay. If anyone wants to contribute/collaborate in this area, please put your hand up!

ryanheise avatar Nov 10 '25 07:11 ryanheise

My intention was to expose all of the relevant APIs related to Android Auto, so that if you just follow Android's own documentation on how to set up Android Auto, you should be able to find the equivalent in audio_service to carry out every step. If you report anything missing from audio_service needed for AA, I'll add it.

Hi @ryanheise ,

Is there a way to integrate AudioService with the car_play plugin? Some of our users have music apps and others don’t. Since the car_play plugin needs to support both scenarios, we’re trying to find a clean approach to link your audio layer with CarPlay’s interface. We don’t want to replace or modify your Android Auto integration, we just want to understand how developers can reuse the audio functionality of your package when working with the car_play plugin.

EArminjon avatar Dec 05 '25 16:12 EArminjon