react-native-greet-solutions
v1.0.19
Published
SDK for RN of Greet Solutions
Downloads
17
Readme
Greet Solutions Platform
Greet Solutions is a user recognition platform that detects store visitors through native SDKs and routers.
Requirements
- Contact with Greet Solution sales department to get your Greet Solutions App ID, available in Keys & IDs.
IOS
- An iOS device (iPhone, iPad, iPod Touch) to test on.
- A Mac with a new version of Xcode.
Installation
With react-native-cli
Install library
from npm
npm install react-native-greet-solutions
from yarn
yarn add react-native-greet-solutions
Usage
import React, { useEffect } from 'react'
import { NativeEventEmitter} from 'react-native';
//...
import SdkGreetSolutions from "react-native-greet-solutions";
const SDKEvents = new NativeEventEmitter(SdkGreetSolutions)
//...
Methods
| Name | Parameters | Description | | ---------------------- | ---------------------------------------- | -----------------------------------------------------------| | setCredencials() | keyClient, customerId, callback function | Set client credentials | | startWifiPermissions() | N/A | Make the automatic connection with the wifi | | registerUserInServer() | name, phone, email, clientTokenId | User Register in to cloud | | registerUserInLocal() | N/A | UUID Register in Router |
setCredencials()
const onSetCredentials = () => {
let keyClient = "XXXXXXXXXXXXX-XXXXXXXXXXXXXX";
let customerId = "XXXXXXXXXXXXXX";
SdkGreetSolutions.setCredencials(keyClient, customerId, (resp) => { console.log("Set Credentials response:", resp) })
}
Add a listener
useEffect(() => {
// ...
SDKEvents.addListener('onSetCredentials', result => {
console.log('onSetCredentials received', result)
})
// ...
}, []);
startWifiPermissions()
const onStartWiFi = async () => {
try {
await SdkGreetSolutions.startWifiPermissions()
} catch (e) {
console.log(e.message, e.code)
}
}
Add a listener
useEffect(() => {
// ...
SDKEvents.addListener('onStartWifi', result => {
console.log('onStartWifi received', result)
})
// ...
}, []);
registerUserInServer()
const onSendUniqueIdToServer = async () => {
try {
await SdkGreetSolutions.registerUserInServer("USER_NAME", "USER_PHONE", "USER_EMAIL", "CLIENT_TOKEN_ID")
} catch (e) {
console.log(e.message, e.code)
}
}
Add a listener
useEffect(() => {
// ...
SDKEvents.addListener('onRegisterUserInServer', result => {
console.log('onRegisterUserInServer received', result)
})
// ...
}, []);
registerUserInLocal()
const onSendUniqueIdToLocalNetwork = async () => {
try {
await SdkGreetSolutions.registerUserInLocal()
} catch (e) {
console.log(e.message, e.code)
}
}
Add a listener
useEffect(() => {
// ...
SDKEvents.addListener('onRegisterUserInLocal', result => {
console.log('onRegisterUserInLocal received', result)
})
// ...
}, []);
iOS React Native SDK
Instructions for adding Greet Solutions SDK to your iOS React Native app.
After the library installation, install the new pod:
cd ios && pod install
Add Privacy Message in Info.plist
This step is important because it’s necessary to ask the user of your app for permission to access their WiFi communication, and Network configuration.
Go to “Info.plist” file.
- Right Click and find “ Open As” and select “Source Code”.
- Copy this code. You can change the message for each privacy message.
<key>NSLocalNetworkUsageDescription</key>
<string>This lets you contact customer services in the store.</string>
Add Required Capabilities
Select the root project, your main app target and "Signing & Capabilities". Then go to new Capability and add "Hotspot Configuration".
Android React Native SDK
Configure Network security policy to router connection
Create res/xml/network_security_config.xml with content:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.10.10.1</domain>
</domain-config>
</network-security-config>
Point to this file from your manifest:
<application
android:networkSecurityConfig="@xml/network_security_config"
android:label="@string/app_name"
android:theme="@style/AppTheme">
</application>