如何在Expo推送通知上添加自定义图标?

huangapple go评论85阅读模式
英文:

How do i add custom icon on expo push notification?

问题

我按照Expo的文档指南链接 进行了操作,但仍然无法工作,推送通知中的图标未显示。

  1. {
  2. "expo": {
  3. ...
  4. "android": {
  5. "package": "com.moohub.safenaija",
  6. "googleServicesFile": "./google-services.json",
  7. "adaptiveIcon": {
  8. "foregroundImage": "./assets/adaptive-icon.png",
  9. "backgroundColor": "#FFFFFF"
  10. }
  11. },
  12. "web": {
  13. "favicon": "./assets/favicon.png"
  14. },
  15. "extra": {
  16. "eas": {
  17. "projectId": ".......",
  18. }
  19. }
  20. },
  21. "plugins": [
  22. [
  23. "expo-notifications",
  24. {
  25. "icon": "./assets/safe.png",
  26. "color": "#000000",
  27. "iosDisplayInForeground": true,
  28. "androidMode": "default",
  29. "androidCollapsedTitle": "Updates from SafeNaija"
  30. }
  31. ]
  32. ]
  33. }

如果有人能帮助解决这个问题,我将不胜感激。

英文:

i followed the documentation guide on expo link , yet it doesn't work ,the icon is not displayed in the push notification

  1. {
  2. "expo": {
  3. ......
  4. "android": {
  5. "package": "com.moohub.safenaija",
  6. "googleServicesFile": "./google-services.json",
  7. "adaptiveIcon": {
  8. "foregroundImage": "./assets/adaptive-icon.png",
  9. "backgroundColor": "#FFFFFF"
  10. }
  11. },
  12. "web": {
  13. "favicon": "./assets/favicon.png"
  14. },
  15. "extra": {
  16. "eas": {
  17. "projectId": "......."
  18. }
  19. }
  20. },
  21. "plugins": [
  22. [
  23. "expo-notifications",
  24. {
  25. "icon": "./assets/safe.png",
  26. "color": "#000000'",
  27. "iosDisplayInForeground": true,
  28. "androidMode": "default",
  29. "androidCollapsedTitle": "Updates from SafeNaija"
  30. }
  31. ]
  32. ]
  33. }

i would appreciate if someone can help solve this issue

答案1

得分: 0

我通过使用具有单色和透明背景的标志来解决了这个问题,生产中一切正常,显示标准标志。

英文:

for people who might have come across this issue, i solved it by using a logo with monochrome color and a transparent background,in production it all works well and displays the standard logo

huangapple
  • 本文由 发表于 2023年2月24日 16:04:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75553980.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定