简体   繁体   中英

MismatchSenderId error Firebase Cloud Messaging (FCM)

I have been facing this error for days, I have read almost every question on this topic, but I haven't figured out the solution.

Please don't mark this as duplicate (I have already looked in the previous Questions).

I had a look at these similar questions ( But no luck ) :

Question 1

Question 2

Question 3

and so many others, I tried out their solutions, such as

  1. Checking whether am using the legacy server or server key or sender Id and the google-services.json file of the same project, on my end it was all correct.
  2. Invalidating cache of android studio and restart.
  3. Cleaning the project and rebuilding it still it doesn't work.

I am using a python library called pyfcm to send notifications to the Android Application, but no luck, below is the function :

def sendMessages():

    push_service = FCMNotification(api_key="AIzaSyxxxxxxxxx")
    registration_id = "fd9JpOrrSbc:APA91bHOmsE99dtUXXXXXXXXXXXXXXXX"
    message_title = "Cool Me"
    message_body = "Hi john, your customized news for today is ready"
    result = push_service.notify_single_device(registration_id=registration_id, message_title=message_title,
                                               message_body=message_body)

Below is the output :

{'multicast_ids': [8943443862024247709], 'success': 0, 'failure': 1, 'canonical_ids': 0, 'results': [{'error': 'MismatchSenderId'}], 'topic_message_id': None}

This is issue started this week, but the previous one this task was working fine as expected.

I also read on the firebase error documentation error documentation

I know there are lots of issues which cause this but this was my experience I wanted to share, so am using a Mac Core I5, 16 GB Processor 2.3 GHz Intel Core, what I did was to clone the project from Github on to my workmate's PC with the same specifications, and the Registration Device ID worked successfully.

my IDE had a problem ( though, I have restarted it a lot, invalidated cache and restarted it, cleaned it, rebuild and build it but didn't work ), so I have just deployed using my workmates PC and it worked.

So sometimes this error arises because of the IDE. Try as much as you can to clean and rebuild your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM