0.0.3 • Published 5 years ago

firebots-react-native v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

firebots-react-native

PushBots Assignment

Install

$ npm install firebots-react-native --save

Mostly automatic installation

$ react-native link firebots-react-native

Manual installation

Android

In your React Native app:

  1. open android/gradle.properties and add;

    PushBotsAPIKey = "APP_API_KEY"
    PushBotsPlatformCode = "APP_Platform" 
  2. Update the following lines in android/build.gradle app module:

    buildToolsVersion = "29.0.2"
    compileSdkVersion = 29
    targetSdkVersion = 29
  3. In android/build.gradle add either jcenter() or mavenCentral()

    allprojects {
    	repositories {
    		...
    		jcenter() //or mavenCentral()
    		....
    	}
    }
  4. This module uses AndroidX should add this lines in android/gradle.properties:

      android.useAndroidX=true
      android.enableJetifier=true

Usage

in your App.js

import React from 'react';

import FireBots from 'react-native-firebots-android';

class App extends React.Component {


  componentWillMount() {
    FireBots.addEventListener('FireBots_onMessageReceived', this.onReceived);
    FireBots.addEventListener('FireBots_onNotificationOpened', this.onClicked);
  }


  componentWillUnMount() {
    FireBots.addEventListener('FireBots_onMessageReceived', this.onReceived);
    FireBots.addEventListener('FireBots_onNotificationOpened', this.onClicked);
  }



  onReceived(notification) {
    console.log(notification)
  }


  onClicked(notification) {
    console.log(notification)

  }


}


export default App;
0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago