How to read SMS in "react-native" app even if the app is open or closed? - react-native

How to react-native as soon as SMS is received (whether the app is closed or open) doing some things like sending a notification or opening the app and ...
Can this be done at all in RN?

Some libraries exist for Android, such as this one: https://github.com/andreyvital/react-native-android-sms-listener
It will allow your react-native app to listen for any SMS and to retrieve the message.
It's a bit different for iOS. Currently, only iOS 12 allows you to get a Security Code from a SMS through the Password Autofill Workflow.
Have a look at the documentation for reference: https://developer.apple.com/documentation/security/password_autofill/about_the_password_autofill_workflow
or this answer: https://stackoverflow.com/a/50791570/2710530

Related

Hpw to do In app notification from Backend [duplicate]

This question already has an answer here:
How to send In-APP Notification in Firebase using Python SDK for Android | iOS
(1 answer)
Closed 4 months ago.
Is it possible to send in-app notification from spring boot app?
Based on the docs and sdk firebase-admin I could send push notifications. But for in app messaging I am not sure that will help send notifications from backend server
In-app messaging, as its name implies, is for messages that are triggered from (and displayed) inside the app. When the user is not actively using the app, you'll usually instead want to send a notification to Cloud Messaging, with shows up in the notification panel.
There is no direct way to trigger In-app messaging from your own server, but since the triggers are based on Analytics events - you could send a message from your server to the device (for example as a data message through FCM) and then use that in the app as a signal to log a certain analytics event that then triggers In-app messaging.
Also see:
Firebase In-app messaging send message whenever we need option?
How to send In-APP Notification in Firebase using Python SDK for Android | iOS

React Native Push Notifications doesn't receive notification

I have a React Native app (testing on iOS) and am trying to incorporate Push notifications. I am using the following module:https://www.npmjs.com/package/react-native-firebase-push-notifications.
I tried running example app code and am able to obtain
a (1) message token and (2) successfully obtain permissions from my device.
I am trying to send a test notification from Firebase and am using my device's token. However, nothing happens upon triggering a test notification. Any tips? I believe I followed the key upload instructions correctly (https://firebase.google.com/docs/cloud-messaging/ios/certs)
I hope you have uploaded pem/p8 file on firebase console at "Cloud Messaging" in Project settings. Check this image
I figured it out! Although I thought I had done this in the past, I did not have Remote notification enabled in background modes, nor did I have Push notifications checked in the Signing & Capabilities section of project setting on Xcode. Thank you!

How to add chat feature in a react native application that updates chat instantly if the message arrives from opposite side?

I have implemented a chat feature in my application, but the issue I am facing is the screen does not refresh automatically if the user gets a message.
I looked for several options on the internet, but all I could find is paid services or using firebase.
Is there any free option to implement it without using firebase?
I want to refresh my chat screen instantly the message is received from the other side.

Expo AuthSession: WebBrowser.dismissBrowser is not available on android

Having the error running on android:
The method or property WebBrowser.dismissBrowser is not available on
android, are you sure you've linked all the native dependencies
properly?]
- node_modules/#babel/runtime/helpers/construct.js:30:26 in _construct
- node_modules/#babel/runtime/helpers/wrapNativeSuper.js:26:23 in Wrapper
- ... 19 more stack frames from framework internals
I can open a browser. Once inside the browser if I quit the browser and went back to the application, the above message show up.
I tried look at WebBrowser from expo documentation
WebBrowser.openAuthSessionAsync(url, redirectUrl)
Opens the url with Safari in a modal on iOS using SFAuthenticationSession. The user will be asked whether to allow the app to authenticate using the given url. Unavailable on Android.
What does the line mean? does that mean android don't work etc.
The user will be asked whether to allow the app to authenticate using
the given url. Unavailable on Android.

React Native Remote Notifications

So what are your experiences with sending remote notifications to RN app from FCM?
I did some research today, tried bunch of tutorials, but most of them didn't work.
So I wanna hear your opinion, which library are you using for this and what guide did you follow?
react-native-push-notification
react-native-fcm
react-native-firebase
react-native-onesignal
I did the connection a few days ago. It is not difficult but it requires a lot of configuration as notification is a native feature. I recommend you the following library that can help you:
React Native FCM
Also take in count the following things:
For ios you need get some certificates from apple.
This guide help with the setup and android part.
Remote notification can't reach iOS emulator since it can't fetch APNS token. Use real device.
I used to react-native-fcm, but now I use react-native-firebase, it is simple to use, just follow the documentation https://rnfirebase.io/docs/v5.x.x/getting-started
just follow the installation tab guide, cloud messaging tab guide, and notification tab, also you can find js code there. for IOS part, you need some extra work to add some certificate to your developer id and add some certificate to your firebase app.