i want to send push notification to my device with Firebase Cloud Messaging, everything is fine while using Firebase Composer panel, i can send and receive Messages through composer, but when i want to do it with python, i don't receive any Message on my device though The response says that Message sent successfully , here is my code:
from __future__ import print_function
import datetime
import firebase_admin
from firebase_admin import messaging
from firebase_admin import credentials
def send_to_token():
# [START send_to_token]
# This registration token comes from the client FCM SDKs.
registration_token = 'my-android-device-registration-token'
# See documentation on defining a message payload.
message = messaging.Message(
data={
'score': '850',
'time': '2:45',
},
token=registration_token
)
# Send a message to the device corresponding to the provided
# registration token.
response = messaging.send( message)
# Response is a message ID string.
print('Successfully sent message:', response)
# [END send_to_token]
if not firebase_admin._apps:
cred = credentials.Certificate('google.json')
default_app = firebase_admin.initialize_app(cred)
send_to_token()
and it gives me this response that indicates successful operation:
projects/app-name/messages/0:1650xxxxx4999573%4bf3b6xxxxxd7ecd
but i don't receive any notification on my device and i cant find the problem.
so where is my problem? is it in my code?
thank you.