Akhil Boddu
Akhil Boddu

Reputation: 1

Expo notifications working locally when running expo, but not working after pushing new build to testflight

In my react native expo app, the push-notifications work locally, and I have created a button to trigger this notification. When I create a dev-build using eas for android the notifications do not come through in production on the APK. Its the same case when I have made a push to testflight. I have confirmed that a valid expo token is being used and am storing that in my zuzstand store.

I am using sdkVersion: '47.0.0',

Any guidance will be appreciated, just need to get notifications working in my builds outside of the expo app!

I followed the official expo documentation for push notifications step by step, which included setting up the firebase console as well as uploading the FCM key to my expo.dev creds.

This is the code that I tried that is linked to the button on my frontend. Works locally, but not in production.

export async function sendPushNotification(expoPushToken) {
  const message = {
    to: expoPushToken,
    sound: "default",
    title: "Welcome",
    body: "Body text",
    data: { someData: "goes here" },
  };

  await fetch("https://exp.host/--/api/v2/push/send", {
    method: "POST",
    headers: {
      Accept: "application/json",
      "Accept-encoding": "gzip, deflate",
      "Content-Type": "application/json",
    },
    body: JSON.stringify(message),
  });
}

Upvotes: 0

Views: 381

Answers (1)

Robin
Robin

Reputation: 1

Once the app is pushed to production. Allow notification for the app on your android device. It should be a permissions issue.

Upvotes: 0

Related Questions