1.0.19 • Published 2 years ago

react-native-greet-solutions v1.0.19

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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

NameParametersDescription
setCredencials()keyClient, customerId, callback functionSet client credentials
startWifiPermissions()N/AMake the automatic connection with the wifi
registerUserInServer()name, phone, email, clientTokenIdUser Register in to cloud
registerUserInLocal()N/AUUID 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".

xcode-add

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>
1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago