react-native-sms-retriever
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "react-native-sms-retriever", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Android SMS Retriever API for React Native", | ||
"homepage": "https://bruno-furtado.github.io/react-native-sms-retriever", | ||
"homepage": "https://github.com/Bruno-Furtado/react-native-sms-retriever", | ||
"readme": "https://github.com/Bruno-Furtado/react-native-sms-retriever#readme", | ||
@@ -7,0 +7,0 @@ "license": "MIT", |
[![Platform][platform-badge]][platform-url] | ||
[![License][license-badge]][license-url] | ||
[![NPM][npm-badge]][npm-url] | ||
[![Downloads][downloads-badge]][downloads-url] | ||
[![Gitter][gitter-badge]][gitter-url] | ||
@@ -27,42 +30,4 @@ <p align="center"> | ||
#### Manual (if you don't like to use react-native link) | ||
> If you don't like to use `react-native link`, check [Manual Installation Wiki Page](https://github.com/Bruno-Furtado/react-native-sms-retriever/wiki/Manual-Installation). | ||
1. Add the following lines to `android/settings.gradle`: | ||
```gradle | ||
include ':react-native-sms-retriever' | ||
project(':react-native-sms-retriever').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sms-retriever/android') | ||
``` | ||
2. Add the compile line to the dependencies in `android/app/build.gradle`: | ||
```gradle | ||
dependencies { | ||
// ... | ||
compile project(':react-native-sms-retriever') | ||
} | ||
``` | ||
3. Add the import and link the package in `MainApplication.java`: | ||
```java | ||
import me.furtado.smsretriever.RNSmsRetrieverPackage; // <-- Add the import | ||
public class MainApplication extends Application implements ReactApplication { | ||
// ... | ||
@Override | ||
protected List<ReactPackage> getPackages() { | ||
return Arrays.<ReactPackage>asList( | ||
new MainReactPackage(), | ||
// ... | ||
new RNSmsRetrieverPackage() // <-- Add it to the packages list | ||
); | ||
} | ||
// ... | ||
} | ||
``` | ||
## Basic Usage | ||
@@ -98,20 +63,7 @@ | ||
#### About Phone | ||
> If you have problems to get the SMS content, check the [SMS Rules Wiki Page](https://github.com/Bruno-Furtado/react-native-sms-retriever/wiki/SMS-Rules). | ||
To get the phone number, use a real device. The [SMS Retriever API](https://developers.google.com/identity/sms-retriever/overview) doesn't work very well with emulators. | ||
#### About SMS | ||
## Methods | ||
The [SMS Retriever API](https://developers.google.com/identity/sms-retriever/overview) has some rules for message. A valid verification message might look like the following: | ||
```txt | ||
<#> Your Example app code is: 123ABC78 | ||
/SBnkJ8069Q | ||
``` | ||
The `<#>` is required. The `/SBnkJ8069Q` is a hash string that identifies your app (in the case it's the hash of the [example](https://github.com/Bruno-Furtado/react-native-sms-retriever/blob/master/example) app). Too see how to generate the hash access [this link](https://developers.google.com/identity/sms-retriever/verify#1_construct_a_verification_message). Alternatively, you can get your app's hash string with the [AppSignatureHelper](https://github.com/googlesamples/android-credentials/blob/master/sms-verification/android/app/src/main/java/com/google/samples/smartlock/sms_verify/AppSignatureHelper.java) class. | ||
## Methods and Errors | ||
#### `requestPhoneNumber(): Promise<String>` | ||
@@ -121,12 +73,2 @@ | ||
| Error Type | Error Message | | ||
| --------------------------------- | ------------------------------------------------------------ | | ||
| ACTIVITY_NULL_ERROR_TYPE | Activity is null. | | ||
| ACTIVITY_RESULT_NOOK_ERROR_TYPE | There was an error trying to get the phone number. | | ||
| CONNECTION_SUSPENENDED_ERROR_TYPE | Client is temporarily in a disconnected state. | | ||
| CONNECTION_FAILED_ERROR_TYPE | There was an error connecting the client to the service. | | ||
| SEND_INTENT_ERROR_TYPE | There was an error trying to send intent. | | ||
| UNAVAILABLE_ERROR_TYPE | Google Play Services is not available. | | ||
| UNSUPORTED_VERSION_ERROR_TYPE | The device version of Google Play Services is not supported. | | ||
#### `startSmsRetriever(): Promise<Boolean>` | ||
@@ -136,8 +78,2 @@ | ||
| Error Type | Error Message | | ||
| --------------------------------- | ------------------------------------------------------------ | | ||
| TASK_FAILURE_ERROR_TYPE | Task failed. | | ||
| UNAVAILABLE_ERROR_TYPE | Google Play Services is not available. | | ||
| UNSUPORTED_VERSION_ERROR_TYPE | The device version of Google Play Services is not supported. | | ||
#### `addSmsListener(event: Function): Promise<Boolean>` | ||
@@ -147,8 +83,2 @@ | ||
| Error Param | Type | Description | | ||
| ----------- | ------ | ------------------------------------------------------------ | | ||
| extras | String | Sent only when there was a problem getting the SMS content. | | ||
| status | String | Sent only when status is not `OK` or `TIMEOUT`. | | ||
| timeout | String | Sent only when status is equals to `TIMEOUT`. | | ||
#### `removeSmsListener(): Void` | ||
@@ -158,3 +88,5 @@ | ||
> Check the erros of each method on [Erros Wiki Page](https://github.com/Bruno-Furtado/react-native-sms-retriever/wiki/Errors). | ||
## Change-log | ||
@@ -174,1 +106,7 @@ | ||
[license-url]: https://github.com/Bruno-Furtado/react-native-sms-retriever/blob/master/LICENSE | ||
[npm-badge]: https://badge.fury.io/js/react-native-sms-retriever.svg | ||
[npm-url]: https://badge.fury.io/js/react-native-sms-retriever | ||
[downloads-badge]: https://img.shields.io/npm/dw/react-native-sms-retriever.svg | ||
[downloads-url]: https://www.npmjs.com/package/react-native-sms-retriever | ||
[gitter-badge]: https://badges.gitter.im/react-native-sms-retriever/community.svg | ||
[gitter-url]: https://gitter.im/react-native-sms-retriever/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge |
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
7229
0
1253273
106