0

I have a flutter app for music reprodution. It should start playing when the user asks the assistant "Play in the app ". It implements the needed hooks for media using the flutter audio_service package. As analyzed by Media Controller Tester:

PlaybackState = STATE_NONE 
ACTIONPLAY = Supported 
ACTIONLPLAY_FROM_MEDIA_ID = Supported 
ACTION_PLAY_FROM_SEARCH= Supported 
ACTION_PLAY_FROM_URI = Supported 
ACTIONLPREPARE = Supported 
ACTION_PREPARE_FROM_MEDIA_ID = Supported 
ACTION_PREPARE_FROM_SEARCH = Supported 
ACTION_PREPARE_FROM_URI = Supported

But the assistant still wont recognize it.

This is the android/app/src/main/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.WAKE_LOCK"/>
 <uses-permission android:name="android.permission.RECORD_AUDIO" />
 <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING" />
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
 <application
 android:label="App name"
 android:name="${applicationName}"
 android:icon="@mipmap/ic_launcher"
 android:enableOnBackInvokedCallback="true"
 >
 <activity
 android:name=".MainActivity"
 android:exported="true"
 android:launchMode="singleTop"
 android:taskAffinity=""
 android:theme="@style/LaunchTheme"
 android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
 android:hardwareAccelerated="true"
 android:windowSoftInputMode="adjustResize">
 <intent-filter android:autoVerify="true">
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.BROWSABLE" />
 <data android:scheme="https"
 android:host="app-host.com"
 android:pathPrefix="/play" />
 </intent-filter>
 <!-- If I add this, it still wont work -->
 <!-- <intent-filter>
 <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
 <category android:name="android.intent.category.DEFAULT" />
 </intent-filter> -->
 <meta-data
 android:name="io.flutter.embedding.android.NormalTheme"
 android:resource="@style/NormalTheme"
 />
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 <meta-data
 android:name="android.app.shortcuts"
 android:resource="@xml/shortcuts" 
 />
 </activity>
 <meta-data
 android:name="flutterEmbedding"
 android:value="2" />
 <!-- flutter_foreground_task specific -->
 <service
 android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
 android:foregroundServiceType="dataSync|remoteMessaging"
 android:exported="false"
 />
 
 <!-- audio_service specific -->
 <service android:name="com.ryanheise.audioservice.AudioService"
 android:exported="true"
 android:foregroundServiceType="mediaPlayback">
 <intent-filter>
 <action android:name="android.media.browse.MediaBrowserService" />
 </intent-filter>
 </service>
 <receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver"
 android:exported="true">
 <intent-filter>
 <action android:name="android.intent.action.MEDIA_BUTTON" />
 </intent-filter>
 </receiver>
 
 </application>
 <queries>
 <intent>
 <action android:name="android.intent.action.PROCESS_TEXT" />
 <data android:mimeType="text/plain" />
 </intent>
 </queries>
</manifest>

I tried adding this to the main activity:

<intent-filter>
 <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
 <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

But it conflicted with audio_service.

Thanks for any help!

asked Aug 27, 2025 at 19:53

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.