1.2.1 • Published 2 years ago

rn-sms-retriever v1.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

rn-sms-retriever

React Native implementation of Android SMS Retriever. No READ_SMS permisssion is required now, instead we have to use SMS retriever.

For better understanding, please refer this article.

Version 1.2.1 is here :)

  • Fixed - Warning -> Explicitly set requiresMainQueueSetup flag to false.
  • Updated implementation 'com.google.android.gms:play-services-auth:20.3.0'
  • Updated implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'

Installation

npm install rn-sms-retriever

Usage

import RnSmsRetriever from 'rn-sms-retriever';

export default function App() {
  React.useEffect(() => {
    let smsListener: undefined | EmitterSubscription;
    async function innerAsync() {
      // get list of available phone numbers
      try {
        const selectedPhone = await RnSmsRetriever.requestPhoneNumber();
        console.log('Selected Phone is : ' + selectedPhone);
      } catch (e) {
        console.log('Get Phone error', e);
      }
      // get App Hash
      const hash = await RnSmsRetriever.getAppHash();
      console.log('Your App Hash is : ' + hash);
      // set Up SMS Listener;
      smsListener = DeviceEventEmitter.addListener(
        RnSmsRetriever.SMS_EVENT,
        (data: any) => {
          console.log(data, 'SMS value');
        }
      );
      // start Retriever;
      await RnSmsRetriever.startSmsRetriever();
    }
    // only to be used with Android
    if (Platform.OS === 'android') innerAsync();
    return () => {
      // remove the listsner on unmount
      smsListener?.remove();
    };
  }, []);
  //....
}

Release Key Hash

If you face any issues with creating Release Key hash follow these steps

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

1.2.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.2.1

2 years ago

1.1.3

2 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.0.2

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.0

4 years ago