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 devices never receive data-only message #815

Open
Pedrozena opened this issue Sep 28, 2024 · 0 comments
Open

iOS devices never receive data-only message #815

Pedrozena opened this issue Sep 28, 2024 · 0 comments

Comments

@Pedrozena
Copy link

Pedrozena commented Sep 28, 2024

Describe your environment

  • Operating System version: Amazon Linux 2 (AWS Lambda)
  • Firebase SDK version: 6.5.0
  • Firebase Product: messaging
  • Python version: 3.10
  • Pip version: _____

Describe the problem

I'm having the same problem reported here https://stackoverflow.com/questions/69244666/flutter-with-firebase-messaging-ios-device-doesnt-receive-data-only-messages
Since the question in unanswered for 3 years, I guess it's fine to open an issue here.

Android devices receive data-only messages, while iOS ones receive regular messages with non-null notifications.
While using legacy FCM api with the following payload:

{
  "to": token,
  "priority": "high",
  "content_available": true,
  "data": {
    "new_message": {
      "sender_uid": sender_uid,
      "message_payload": message,
    },
  },
}

iOS devices regularly receive also data-only messages.

Steps to reproduce:

I'm sending messages to my devices with the following code:

from firebase_admin import messaging

def send_message_to_token(token, notification=None):
    data = {"foo": "bar"}
    apns = None
    android = None
    if notification is None:
        apns = messaging.APNSConfig(
            payload=messaging.APNSPayload(
                aps=messaging.Aps(content_available=True, custom_data={"gcm.message_id": str(uuid.uuid4())})
            )
        )
        android = messaging.AndroidConfig(priority="high")
    else:
        notification = messaging.Notification(**notification)
    message = messaging.Message(data, notification=notification, token=token, apns=apns, android=android)
    messaging.send(message, app=get_app())
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

2 participants