Phone won't vibrate when receiving firebase push notification

I am sending firebase push notification using the python sdk but I am having an issue. Even though the notifications are being delivered, however it doesn't vibrate the phone. Below is my code.

message = messaging.Message(
                    token=token,
                    notification=messaging.Notification(
                        title=title,
                        body=body,
                    ),
                )

messaging.send(message)

I have tried everything, used data message also but no difference. I have also tried some examples on here but still the same thing. I would really appreciate any help. Thank you

If you want to ensure that the notifications trigger vibration on the receiving device, here's how you can modify your code:

message = messaging.Message(
                    data={"title": title, "body": body},
                    token=token,
                    notification=messaging.Notification(
                        title=title,
                        body=body,
                    ),
                    android=messaging.AndroidConfig(
                        priority="high",  # Set priority for Android
                        notification=messaging.AndroidNotification(
                            sound="default",  # Set sound to default for Android # Vibration pattern in milliseconds
                        ),
                    ),
                    apns=messaging.APNSConfig(
                        payload=messaging.APNSPayload(
                            aps=messaging.Aps(
                                sound="default",  # Set sound to default for iOS
                                content_available=True,  # Enable background content availability for iOS
                            )
                        )
                    ),
                )

messaging.send(message)

This improvement ensures that both Android and iOS devices receive notifications with proper configurations for sound, vibration, and additional data.

Back to Top