react-nativepush-notificationexporeact-native-push-notification

Will an Android app only receive push notifications is the app was downloaded from the Google Play Store? (React Native Expo)


I'm using Expo push notifications. Push notifications work fine in Expo Go and for apps on published to the Google Play store. But when I create an APK file and download it directly onto my Android phone, NOT through the Google Play store, the push notifications I send are not received.

Will push notifications only work for apps published to the Google Play store? Or is there a way to receive push notifications for apps downloaded directly onto an Android phone without being published to the Google Play store?


Solution

  • I forgot to import { Platform } from 'react-native'.

    Also, I needed to upload Android server api key credentials which can be found in Firebase Console in your project settings under Cloud Messaging. Here is how to upload the server api key credentials in the terminal:

    expo push:android:upload --api-key <your-token-here>
    

    Documentation can be found here under "Uploading Server Credentials": https://docs.expo.dev/push-notifications/using-fcm/