Code Monkey home page Code Monkey logo

react-native-hotline's Introduction

# react-native-hotline

hotline.io integration with React Native App for Android

#1

Add below lines to project level build.gradle

Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

 repositories {
     jcenter()
 }

 dependencies {
     classpath 'com.android.tools.build:gradle:2.2.3'
     classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
 }
}

 allprojects {
     repositories {
         jcenter()
         maven { url "https://maven.google.com" }
         maven { url "https://jitpack.io" }
         maven {
             url "$rootDir/../node_modules/react-native/android"
         }
     }
 }

#2

Now app level build.gradle

add this dependency under dependencies:

dependencies{
    ....
    compile 'com.github.freshdesk:hotline-android:1.2.5'

}

#3

Add the above java files Constants,HotLineModule,HotLineReactPackage to your Java source folder.

#4

After addding,include your HotLineReactPackage to MainApplication where all your packages includes

,new HotLineReactPackage()

#5

Now Final Step is to add HotLine Configuration in your MainActivity under onCreate method

I added these lines of code under onCreate().

HotlineConfig hlConfig = new HotlineConfig(Constants.HOTLINE_APP_ID, Constants.HOTLINE_APP_KEY);

hlConfig.setVoiceMessagingEnabled(false);//depends on your requirement

hlConfig.setCameraCaptureEnabled(true);//depends on your requirement

hlConfig.setPictureMessagingEnabled(true);//depends on your requirement

Hotline.getInstance(getApplicationContext()).init(hlConfig);

#6

Now call show method from your .js(from where you want to trigger the action) in your react-native project

Don't forget to import NativeModules before calling i.e add the following line

import {NativeModules} from 'react-native';

then place below line under any action (onPress)

NativeModules.HotLineChat.show(param1,param2,param3)

You might ask what is HotLineChat?

That is what we have returned our Module name as in HotLineModule.java file under getName() method

react-native-hotline's People

Contributors

trinadhkoya avatar

Stargazers

 avatar

Watchers

 avatar

react-native-hotline's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.