I have a custom notification sound for FCM in my Flutter App working properly when I set the targetSdkVersion to 25 but once I change the targetSdkVersion to 28 default sound is played instead.
I'm using plugin firebase_messaging 6.0.9
This is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="*********">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name=".Application"
android:label="*****"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="*********"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_notification"
/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
And this is my payload:
public function toFcm($notifiable)
{
$message = new FcmMessage();
$notification = [
'title' => "Nouvelle commande #".$this->order->id." pour ".$this->order->foodOrders[0]->food->restaurant->name,
'body' => $this->order->user->name,
'icon' => $this->order->foodOrders[0]->food->restaurant->getFirstMediaUrl('image', 'thumb'),
'sound' => 'sale.wav', // Optional
'click_action' => "FLUTTER_NOTIFICATION_CLICK",
'id' => '1',
'status' => 'done',
];
$message->content($notification)->data($notification)->priority(FcmMessage::PRIORITY_HIGH);
return $message;
}
I'm not sure what I'm missing, thanks for your help!