Expo notification with FCM

Does anyone have any examples of standalone apps using fcm to notify?
Or how can I do this? I am using the documentation Using FCM for Push Notifications - Expo Documentation and Sending Notifications with APNs & FCM - Expo Documentation but MismatchSenderId is returning ". Could someone help me?

it may be useful for you to search for related discussions on the forums: Search results for 'MismatchSenderId' - Forums

thanks, i will search. Is there a way to send notification to standalone apps without using FCM? For example using devicepushtoken and https://exp.host/--/api/v2/push/send?

the underlying implementation uses FCM. in expo client, we use our own FCM api key to send the notification, but in your own standalone app we need to use yours. we just need to know what it is so we can send notifications through the expo push service (Push notifications setup - Expo Documentation)

Along with the expo-notifications module, which provides all the client-side functionality for push notifications, Expo can also handle sending these notifications off to APNs and FCM for you! All you need to do is send the request to our servers with the ExpoPushToken you grabbed in the last step.

Here you are insisting on returning “MismatchSenderId”, and I guarantee that it is configured and the google-services.json file is correct. Is it possible to see if my credentials in the project are ok?

you need to provide more clear information when asking for help :slight_smile: are you using the expo push service?

most likely the google-services config is incorrect, or maybe you didn’t do a new build (expo build:android) after adding it

1 Like

Sorry, I’m new here. I use the expo push services, but using the expo app itself, the problem is that when generating the .apk, the token was no longer recognized. Cada .apk também tem 1 ExponentPushToken?
I already made a new build after I added google-services. My question is whether I can use the service https://exp.host/--/api/v2/push/send using getExpoPushTokenAsync + FCM, or it needs to be getDevicePushTokenAsync using https://fcm.googleapis.com/fcm/send ?

Thanks for your attention, and sorry for the lack of experience

My question is whether I can use the service https://exp.host/--/api/v2/push/send using getExpoPushTokenAsync + FCM, or it needs to be getDevicePushTokenAsync using https://fcm.googleapis.com/fcm/send ?

If you want to use FCM directly, as per the documentation here, you’ll need to use getDevicePushTokenAsync.

If you want to use Expo’s push service (which uses FCM behind the scenes), as per the documentation here, you’ll need to use getExpoPushTokenAsync.

If you’re new, I highly recommend using Expo’s push service, which will reduce the complexity a lot and just generally make your life a lot easier :smile: it’s also really easy to transition from one to another so by no means is this a choice that locks you in either way

In case you’re still seeing MismatchSenderId- that likely means that the project_number in your google-services file is not the same as the Sender ID here- https://console.firebase.google.com/project/_/settings/cloudmessaging/. Make sure you downloaded the most recent google-services file, from the correct project, with the proper package name setup, and have updated your FCM server key stored on Expo’s servers (use the command expo push:android:upload)

1 Like

It worked. I was using the expo token different from the current one. Thanks guys for your attention

1 Like