1

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?

Ali Zali
  • 383
  • 1
  • 2
  • 10

1 Answers1

2

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

Neeko
  • 1,139
  • 1
  • 10
  • 26
  • The solution you linked for IOS is not targeted at React Native. It's actually as simple as using `textContentType="oneTimeCode"` [docs](https://reactnative.dev/docs/next/textinput#textcontenttype) – Dror Bar Mar 02 '21 at 12:24