Need help with react-native-sms-retriever?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

Bruno-Furtado
188 Stars 64 Forks MIT License 36 Commits 28 Opened issues

Description

Android SMS Retriever API for React Native.

Services available

!
?

Need anything else?

Contributors list

# 68,612
Objecti...
Swift
otp
React N...
29 commits
# 72,351
TypeScr...
CSS
React
React N...
1 commit
# 3,190
imagema...
sass-fr...
splash
pipelin...
1 commit

Platform License NPM Downloads Codebeat Gitter

Cover

With the SMS Retriever API, you can perform SMS-based user verification in your Android app automatically, without requiring the user to manually type verification codes, and without requiring any extra app permissions.



Read Phone Number

Read SMS


Installation

Automatic linking (>= 0.60)

npm install --save react-native-sms-retriever

Manual linking (< 0.60)

npm install --save react-native-sms-retriever
react-native link react-native-sms-retriever

If you don't like to use

react-native link
, check Manual Installation Wiki Page.

Basic Usage

import SmsRetriever from 'react-native-sms-retriever';

// Get the phone number (first gif) _onPhoneNumberPressed = async () => { try { const phoneNumber = await SmsRetriever.requestPhoneNumber(); } catch (error) { console.log(JSON.stringify(error)); } };

// Get the SMS message (second gif) _onSmsListenerPressed = async () => { try { const registered = await SmsRetriever.startSmsRetriever(); if (registered) { SmsRetriever.addSmsListener(event => { console.log(event.message); SmsRetriever.removeSmsListener(); }); } } catch (error) { console.log(JSON.stringify(error)); } };

If you have problems to get the SMS content, check the SMS Rules Wiki Page.

Methods

| Method | Return | Description | | :------------------------------ | :----------------- | :------------------------------------------------------ | | requestPhoneNumber() |

Promise
| Obtain the user's phone number (using the hint picket). | | startSmsRetriever() |
Promise
| Start to listen for SMS messages. | | addSmsListener(event: Function) |
Promise
| Get the SMS content with:
event.message
. | | removeSmsListener() |
Void
| Stop to listen for SMS messages. |

Check the erros of each method on Erros Wiki Page.

Change-log

A brief summary of each React Native SMS Retriever release can be found on the releases.

License

This code is distributed under the terms and conditions of the MIT License.


Made with ❤ in Curitiba 🇧🇷

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.