libverify-rn
v0.0.10
Published
Bridge for native iOS/Android library verify by mail.ru
Downloads
7
Readme
react-native-libverify
Install
- Add dependency with
$ npm install libverify-rn --save
- Set up Firebase
- Set up Android side
Android
- Create if not exist
GcmMessageHandlerService.java
. Example:
/**
* Resend GCM message from your application to Notify
*/
public class GcmMessageHandlerService extends FirebaseMessagingService {
private static final String LOG_TAG = "GcmMessageHandlerService";
@Override
public void onMessageReceived(RemoteMessage message) {
String from = message.getFrom();
Map<String, String> data = message.getData();
FileLog.v(LOG_TAG, "message received from %s with data %s", from, data);
if (from == null) {
return;
}
VerificationFactory.deliverGcmMessageIntent(this, from, data);
}
@Override
public void onNewToken(String token) {
FileLog.v(LOG_TAG, "token refresh. onNewToken: %s", token);
VerificationFactory.refreshGcmToken(this);
}
}
- Add your handler in
AndroidManifest.xml
<service
android:name=".GcmMessageHandlerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
- Set up credentials and other values in xml (see example/android/app/src/main/res/values/libverify.xml)
<string name="libverify_application_name">*applcation name*</string>
<string name="libverify_application_key">*application key*</string>
<string name="libverify_server_id">297109036349</string>
<!--Dont forget call Verify#setDisableSimDataSend(false) after user allow use phone number-->
<string name="libverify_default_disable_sim_data_send">true</string>
iOS
TODO
Usage
import { Verify, VerifyCancelReason, VerifyFailReason, VerifyState } from 'libverify-rn';