简体   繁体   English

如何为 IOS 推送通知设置自定义图标?

[英]How to set a custom icon to an IOS push notification?

I'm currently adding notifications to my Flutter app for IOS, I wanted to add something similar to a largeIcon on Android, so far I didn't find a way to do that, only adding an image which is not a solution since I only want an icon at the right even if the user expands the notification (the image will expand too in this case which is undesirable for my use case).我目前正在为 IOS 添加通知到我的 Flutter 应用程序,我想在 Android 添加类似于largeIcon的东西,到目前为止我没有找到这样做的方法,只添加一个不是解决方案的图像,因为我只即使用户展开通知,也希望右侧有一个图标(在这种情况下,图像也会展开,这对我的用例来说是不可取的)。

As an alternative, I was wondering if I could change the notification app icon.作为替代方案,我想知道是否可以更改通知应用程序图标。 As far as I looked around, this is not possible either, but at the same time I saw this image of notifications (the first one and the last one) that have a custom image and the app icon is smaller.据我环顾四周,这也是不可能的,但与此同时,我看到了这张通知图片(第一个和最后一个),它有一个自定义图片,应用程序图标更小。

How can I do this in my app?我怎样才能在我的应用程序中执行此操作? I couldn't find any way in the documentation on how to do it.我在文档中找不到任何关于如何做的方法。

在此处输入图像描述

You can do this with communication notifications.您可以通过通讯通知来做到这一点。 From HIG :来自海格

The system automatically displays a large version of your app icon at the leading edge of each notification;系统会自动在每个通知的前缘显示一个大版本的应用程序图标; in a communication notification, the system displays the sender's contact image — or avatar — badged with a small version of your icon.在通信通知中,系统会显示发件人的联系人图像 - 或头像 - 带有您图标的小版本标记。

Here is the documentation on how to implement communication notifications in your app. Here is the documentation on how to implement communication notifications in your app。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM