React Native module for Android automatic SMS verification with SMS retriever API
npm install @busfor/react-native-sms-verification-api!npm


Verify your users by SMS without making them deal with verification code.

---
| 1.0.x | 1.1.x+ |
| :-----------------------: | :------: |
| Android support libraries | AndroidX |
1. Install package
$ yarn add react-native-sms-verification-api
2. Add Kotlin gradle plugin
``gradle`
buildscript {
ext {
...
kotlinVersion = '1.3.50'
}
...
dependencies {
...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlinVersion}"
}
}
Autolinking will just do the job.
$ react-native link @busfor/react-native-sms-verification-api
#### Android
1. Open up android/app/src/main/java/[...]/MainActivity.java
- Add import com.busfor.smsverification.RNSmsVerificationApiPackage; to the imports at the top of the filenew RNSmsVerificationApiPackage()
- Add to the list returned by the getPackages() method
2. Append the following lines to android/settings.gradle:`
`
include ':@busfor_react-native-sms-verification-api'
project(':@busfor_react-native-sms-verification-api').projectDir = new File(rootProject.projectDir, '../node_modules/@busfor/react-native-sms-verification-api/android')
android/app/build.gradle
3. Insert the following lines inside the dependencies block in :`
`
implementation project(':react-native-sms-verification-api')
`javascript
import SmsVerificationApi from "react-native-sms-verification-api";
SmsVerificationApi.requestPhoneNumber()
.then(phone => Alert.alert("SmsVerificationApi.requestPhoneNumber", phone))
.catch(reason => console.log(reason));
SmsVerificationApi.startSmsRetriever();
SmsVerificationApi.addSmsListener(event => {
Alert.alert("SmsVerificationApi.smsRetriever", event.message);
});
SmsVerificationApi.removeSmsListener();
``