npm.io
1.0.8 • Published 5 years ago

@premind/react-native-premind-android

Licence
ISC
Version
1.0.8
Deps
0
Size
281 kB
Vulns
0
Weekly
0

React Native Premind SDK

Get modules

  1. The library is available on npm, install it with:

    npm install @premind/react-native-premind-android

    or

    yarn add @premind/react-native-premind-android

  2. Link the library with your project:

    react-native link @premind/react-native-premind-android

Setup your application

  1. Configure your integration key and secret in the <application ... > tag of your App Manifest file.
    <meta-data android:name="com.premind.premindsdk.KEY" android:value="\ your-KEY-here" />
    <meta-data android:name="com.premind.premindsdk.SECRET" android:value="\ your-SECRET-here" />

  2. Configuration of MainApplication class:
    import com.premind.premindsdk.PremindApplication;

    Change
    public class MainApplication extends Application implements ReactApplication
    To
    public class MainApplication extends PremindApplication implements ReactApplication

Usage

Import it into your project:

import Premind from '@premind/react-native-premind-android'

Authenticate

Authenticate with your own User ID or Token, make sure it is unique and not expired. The return result is true if the authentication is successful.

authenticate = async () => {
    try {
      const result = await Premind.authenticate('userID');     
      if(result == true)
      {
        //authenticate success
        //YOUR_CODE
      }
    } catch (error) {
    
    }
  };

Incognito mode

Get incognito mode (return value is a boolean)

getIsIncognito = async () => {
    try {
      const result = await Premind.getIsIncognito();    
      //YOUR_CODE
    } catch (error) {
    
    }
  };

Set the incognito mode on or off

Premind.setIsIncognito(isIncognito);

Get Me (Profile Info)

const result = await Premind.getMe();

Delete Profile

const result = await Premind.deleteFromProfile(key)
const result = await Premind.deleteVisit(id)
const result = await Premind.deleteInformation(id)

Update Profile

const result = await Premind.updateProfile(key, value)
const result = await Premind.updateInformation(id, key, value)

Keywords