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

iOS Data Only FCM messages not reaching device #7770

Closed
sudhay23 opened this issue Apr 27, 2024 · 3 comments
Closed

iOS Data Only FCM messages not reaching device #7770

sudhay23 opened this issue Apr 27, 2024 · 3 comments
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report

Comments

@sudhay23
Copy link

Hello, I am trying to send a data-only message to an iOS simulator react native app but the callback function in messaging().setBackgroundMessageHandler(onMessageReceived); is not being triggered where I am trying to show a Notifee notification.

const onMessageReceived = async (_message) => {
  // console.log("first", _message);
  // Display a notification

  await notifee.displayNotification({
    title: "From Backend - DATA ONLY",
    body: _message.data,
  });
};

On backend (Node.js)

const message: Message = {
    token: RECEIVER_TOKEN,
    // For FCM Notification Display
    // notification: {
    //   title: "Hello",
    //   body: "World",
    // },
    // If client app wishes to display local notification with additional content
    data: { value: "TESTER BACKEND" },
    // Android Specific Settings
    android: {
      priority: "high",
    },
    apns: {
      payload: { aps: { contentAvailable: true } },
      headers: {
        "apns-push-type": "background",
        "apns-priority": "5",
        "apns-topic": "", // your app bundle identifier
      },
    },
  };

Please assist. Thanks

@sudhay23 sudhay23 added Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report labels Apr 27, 2024
@mikehardy
Copy link
Collaborator

data-only message to an iOS

data-only messages will never be reliable on iOS, if you ever receive them it is a bonus. If you want to have FCM delivered on iOS you need to send a notification block in the FCM

@thanatas
Copy link

thanatas commented May 7, 2024

I am also struggling to get message in IOS emulator. I want to know that on M3 Apple MacBook + Emulator, Is it possible?
OR I am trying for nothing, Is it ?

@mikehardy
Copy link
Collaborator

If you have an up to date macOS and Xcode and iOS version on Apple Silicon, and you have granted your app notification permissions, and then restarted your app, and you then register for remote notifications, it should be possible.

BUT NOT DATA-ONLY MESSAGES ON iOS, those may work they may not but they are unreliable and not useful for testing (since they are unreliable is it a real negative test result for no delivery where your code and config is wrong or a false negative test result for no delivery where system just didn't deliver?). use notification blocks

I do not believe anything here will result in changes to the code in this library, and that's what we use open issues to track so I'm going to close this as a user-specific item - you may find stackoverflow good for firebase support as well, the firebase team hangs out there and helps respond to questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help: Needs Triage Issue needs additional investigation/triaging. Impact: Bug New bug report
Projects
None yet
Development

No branches or pull requests

3 participants