Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Unity ios cloud message with image #1123

Open
jedai7 opened this issue Oct 8, 2024 · 6 comments
Open

[Question] Unity ios cloud message with image #1123

jedai7 opened this issue Oct 8, 2024 · 6 comments

Comments

@jedai7
Copy link

jedai7 commented Oct 8, 2024

What is your question?

I have android and ios build from unity 2021.3.24. And i want to send push notification with image. In Android it works fine
image
but on ios its dont work. Image missing
image
Can you help with this. Maybe i made some mistake

I use this variant for sending messages
image

Firebase Unity SDK Version

12.1.0

Unity editor version

2021.3.24

Installation Method

.unitypackage

Problematic Firebase Component(s)

Messaging

Other Firebase Component(s) in use

Analytics, Crashlytics, Messaging, Remote Config

Additional SDKs you are using

No response

Targeted Platform(s)

Apple Platforms, Android

Unity editor platform

Mac

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jedai7
Copy link
Author

jedai7 commented Oct 11, 2024

any updates?

@argzdev argzdev self-assigned this Oct 14, 2024
@argzdev
Copy link

argzdev commented Oct 22, 2024

Hey @jedai7, sorry this took a while. Upon testing, it seems that this also happens on native iOS. Could you file an issue to the Firebase iOS SDK?

For context, the Firebase Unity SDK acts as a wrapper, and if the underlying SDK encounters the issue, then the fix would likely be applied on the native SDK.

That said, I'll go ahead and close this thread. Feel free to reply back here in case of any updates. Thanks!

@argzdev
Copy link

argzdev commented Nov 20, 2024

Hi @jedai7, our colleagues informed me that it could be an issue specifically with our Unity SDK. Let me investigate this further and reply back once I have updates to share with you.

@argzdev argzdev reopened this Nov 20, 2024
@argzdev
Copy link

argzdev commented Jan 20, 2025

Just some updates, it looks like in iOS there are extra setups needed to get the image to show in Firebase Messaging. Specifically adding, this code snippet.

Now for Unity builds, while I think it is possible to add Notification Service Extension with Xcode after exporting the iOS project. The FCM docs for Unity does not specify how to add the following equivalent code in didReceiveNotificationRequest

@implementation NotificationService

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];

    // Modify the notification content here as you wish
    self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]",
    self.bestAttemptContent.title];

  // Call FIRMessaging extension helper API.
  [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent
                                            withContentHandler:contentHandler];

}

Let me bring this up to our engineers and see if we have an official guide for setting this up.

@argzdev
Copy link

argzdev commented Jan 22, 2025

Hey @jedai7, it looks like we don't have this feature available yet for Firebase Unity SDK. I've consulted this with our engineer and have concluded that we likely need to add an equivalent C# code for this feature. That said, we are unable to promise any timeline for this, but we'll definitely keep this under our radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants