admin管理员组文章数量:1278853
Issue with Image/Icon Not Showing in Push Notification on iOS (Flutter & Laravel FCM)
I'm facing an issue where the image/icon in my push notifications is not showing when the app is terminated or running in the background on iOS. However, it works fine when the app is open.
I'm using Flutter for the frontend and Laravel for sending push notifications via Firebase Cloud Messaging (FCM). I'm not sure if the problem is in my payload structure or in Flutter’s handling of notifications.
Here is my Laravel payload:
$payload = [
'message' => [
'token' => $fcmToken,
'apns' => [
'headers' => [
'apns-push-type' => 'alert',
'apns-priority' => '10',
'apns-topic' => 'com.test.testing',
],
'payload' => [
'aps' => [
'alert' => [
'title' => $title,
'body' => $body,
],
'sound' => 'default',
'mutable-content' => 1,
'content-available' => 1,
],
],
],
'data' => array_merge($formattedData, [
'image' => $avatarUrl,
]),
'android' => [
'priority' => 'high'
],
],
];
I've set mutable-content to 1, but the image still doesn't appear in the notification when the app is terminated or in the background.
Has anyone encountered this issue before? Do I need to adjust my payload, or is there something I need to configure in Flutter?
Any help would be appreciated!
Issue with Image/Icon Not Showing in Push Notification on iOS (Flutter & Laravel FCM)
I'm facing an issue where the image/icon in my push notifications is not showing when the app is terminated or running in the background on iOS. However, it works fine when the app is open.
I'm using Flutter for the frontend and Laravel for sending push notifications via Firebase Cloud Messaging (FCM). I'm not sure if the problem is in my payload structure or in Flutter’s handling of notifications.
Here is my Laravel payload:
$payload = [
'message' => [
'token' => $fcmToken,
'apns' => [
'headers' => [
'apns-push-type' => 'alert',
'apns-priority' => '10',
'apns-topic' => 'com.test.testing',
],
'payload' => [
'aps' => [
'alert' => [
'title' => $title,
'body' => $body,
],
'sound' => 'default',
'mutable-content' => 1,
'content-available' => 1,
],
],
],
'data' => array_merge($formattedData, [
'image' => $avatarUrl,
]),
'android' => [
'priority' => 'high'
],
],
];
I've set mutable-content to 1, but the image still doesn't appear in the notification when the app is terminated or in the background.
Has anyone encountered this issue before? Do I need to adjust my payload, or is there something I need to configure in Flutter?
Any help would be appreciated!
Share Improve this question asked Feb 25 at 9:22 Chhean LymengChhean Lymeng 11 bronze badge 1 |1 Answer
Reset to default 0There are some values that we need to update in your request. Check the example below for things that need updating.
message = {
notification: {
title: 'Sparky says hello!'
},
android: {
notification: {
imageUrl: 'https://foo.bar.pizza-monster.png'
}
},
apns: {
payload: {
aps: {
'mutable-content': 1
}
},
fcm_options: {
image: 'https://foo.bar.pizza-monster.png'
}
},
webpush: {
headers: {
image: 'https://foo.bar.pizza-monster.png'
}
},
topic: topicName,
};
for more details please click here
本文标签: Issue with ImageIcon Not Showing in Push Notification on iOS (Flutter amp Laravel FCM)Stack Overflow
版权声明:本文标题:Issue with ImageIcon Not Showing in Push Notification on iOS (Flutter & Laravel FCM) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741216817a2360202.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
Notification Service Extension
as well. – sonle Commented Feb 25 at 9:30