Socket
Socket
Sign inDemoInstall

react-native-sms-retriever-tr

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-sms-retriever-tr

Android SMS Retriever API for React Native


Version published
Weekly downloads
21
increased by950%
Maintainers
1
Install size
29.8 kB
Created
Weekly downloads
 

Readme

Source

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));
  }
};

// Get App signature, (You can send this to a server for OTPs)
const signature = await SmsRetreiver.getAppSignature();

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

Methods

MethodReturnDescription
requestPhoneNumber()Promise<String>Obtain the user's phone number (using the hint picket).
startSmsRetriever()Promise<Boolean>Start to listen for SMS messages.
addSmsListener(event: Function)Promise<Boolean>Get the SMS content with: event.message.
removeSmsListener()VoidStop to listen for SMS messages.
getAppSignature()Promise<String>Get the App Signature.

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 🇧🇷

Keywords

FAQs

Last updated on 09 Jun 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc