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

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?

Depending on your android version and rom you have to open the app setting's (for me long press app icon).
Select settings
Choose notifications
Enable notification for this app

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/

Related

Push notifications not working in Expo Go

I don't receive push notifications when testing the app in Expo Go with physical devices. However it seems to work fine in a standalone (builded) app.

Configure expo notifications for push notifications

I have 2 apps and I implemented expo push notification and everything was fine, but in the other one it asked me for the experienceid as a prop to Notifications.getExpoPushTokenAsync({
experienceId: "#name/slug,
});
and when trying to send a notification it gives me this error: InvalidCredentials: Unable to retrieve the FCM server key for the recipient's app. Make sure you have provided a server key as directed by the Expo FCM documentation.
I dont want to use FCM, i want to use expo push api.
Can you help me?
The Expo Push API uses FCM for Android, and while it's not necessary to configure it for Expo Go (this is done already for the Expo Go app), when you deploy your standalone app you will need to have it configured for FCM. More information here: https://docs.expo.dev/push-notifications/using-fcm/

React native FCM push notifications not working in IOS Adhoc and TestFlight

Trying to implement push notification in a react native app using google cloud messaging. The notification works perfectly on android device in a simulator and in production. But for IOS, it works only locally only when its ran in a device. In adhoc or test flight, it does not work. I am using the APN key. Anyone faced the same issue? I can see a lot of posts in stack overflow regarding push notification not working for ios but none of the post were helpful for me.
Here's what I have done till now:
Generated an APN Authentication Key in developer.apple.com
Added that key to ios App in firebase.console.google.com
Run the app in a device using xcode - (Push notification works fine everytime.)
Archive the app in xcode and distribute to AdHoc and install the .ipa file in a device. (Push notification does not work)
Distribute to testflight and test the push notification - does not work
Why would it work in debug mode and not in adhoc or testflight.
I checked this:https://stackoverflow.com/a/48111671/8729976 . It says there is a single auth token for both production and development environment so I am guessing its definitely not the key.
Here are the sample responses:
When the push notification is delivered we get status 200 with this message: projects/myproject-name/messages/1602538922793273
When the push notification is not delivered, we still get status 200 with this message: projects/myproject-name/messages/0:1602541135340865%6b2d5f5c6b2d5f5c
Don't know what the second message means.

FCM: Mismatched Sender Id when trying to send notification to Expo app

I have a backend that send fcm to web app and expo apps. Double checked all the credentials. But still unable to get it work. Both of the credentials are under same project. Backend is using firebase admin, with service account. Front end is using google-services.json. Anyone encountered this?
Found out that the device token from expo-notification can only be used on standalone build. But not in expo-client during development.
https://forums.expo.io/t/using-fcm-as-push-notification-with-expo-client/42402/2?u=cyee
This is the copy paste comment by expo team.
Hi! If you want to send notifications directly through FCM, and not
through the Expo notifications service, you’ll have to test in a
standalone app (as in, an app you built with expo build:android). This
is because you don’t have the push credentials for the Expo client
app, only we do :slight_smile:
If you want to test in the Expo client app, then you can do that with
Expo’s notifications, which you can read more about here-
https://docs.expo.io/push-notifications/overview/

Sending a push notification to android device using amazon sns

i already follow the instruction given http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html#registration-id-gcm. But my created app didnt received any notification.
Can someone shed light on me.
You have:
Installed the Android SDK
Installed the Google Play Services SDK
Installed the Android Support Library package
Registered your app with GCM to receive push notification message
(you have a registration ID)
If not, start at http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html.