Getting Started

Install the Referd React Native SDK into your app

The Referd Android and iOS package, enables you to use the show Referd user profile in your app, track app user events, integrate referrals and display Referd's in-app push notifications.

Installation

Follow the below steps to start installing react native SDK package to your app

  • Install package using npm

npm install --save react-native-gameball
  • Install prerequisite packages using npm

npm install react-native-modal react-native-push-notification-popup

react-native-modal and react-native-push-notification-popup packages are required to use gameball package.

Fetch API is used for network communications, conversion of response to json is needed in order to read the response res => res.json()

Initialization

In order to use Referd SDK, apply the below step to the main JS file (index or app).

Import Referd Widget

import {GameballWidget} from ‘react-native-gameball’;

Initialize Referd Widget

GameballWidget.init(gameball_apiKey, lang, shop, platform, deepLinks )
ParameterTypeRequiredDescription

gameball_apiKey

string

Required

Client API key

lang

string

Optional

Your platform language preference to view Referd Widget with.

Note: The language provided should be as per configured languages in your account. If not provided the Referd profile widget will be shown with your account default language

Example: "en", "fr".

Register User

Register user method is used to create or update users at Referd. It is called when your login network call is successful.

First, import Referd SDK as follows:

import {GameballSDK} from 'react-native-gameball';

then

GameballSDK.registerPlayer({
      "playerUniqueId": playerId,
      "playerTypeId": playerTypeId,
      "deviceToken": playerDeviceToken,
      "playerAttributes": {
        "displayName": "Alex",
        "email": "example@example.com",
        "gender": "m",
        "mobileNumber": "01099999999",
        "dateOfBirth": "2019-08-18T10:11:34.478Z",
        "joinDate": "2019-08-18T10:11:34.478Z" 
       }
}).then(res => res.json()).then(jsonResponse => {...}) // on success

Once the APIKey and playerUniqueId have been registered, Referd views can be made visible to the user.

Param

Required

Description

Type

playerUniqueId

Required

PlayerUniqueId is a unique ID for you user, for example UUID or username. The PlayerUniqueId is to be provided by the client and must be unique for each user.

String

playerTypeId

Optional

Each User type has an ID

Integer

playerAttributes

Optional

PlayerAttributes is a builder class which you will use to add or update your player info to Referd.

Object

deviceToken

Optional

Mobile device token used for push notifications Note: Should be sent along with osType

String

Choose an Unchangeable Player Unique ID

Referd user profile gets created using the playerUniqueId. It is highly recommended to have the unique ID as an identifier that would NEVER be changed. If this unique ID changes for a given user, you risk losing all original data for that user on Referd. Accordingly, it is NOT recommended to use email address or mobile number as the unique ID as both can be changed by the user at anytime.

Last updated