Coder Social home page Coder Social logo

djkmiles / react-native-call-log Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wscodelabs/react-native-call-log

0.0 1.0 0.0 106 KB

call-log package for android for react-native

License: MIT License

JavaScript 25.69% Python 11.19% Java 34.49% Objective-C 28.62%

react-native-call-log's Introduction

call log package for android in react-native

Installation:

Run npm install --save react-native-call-log

Android

Option: Automatic(with rnpm)

react-native link

Option: Manually

  • Edit your android/settings.gradle to look like this (exclude +)
+ include ':react-native-call-log'
+ project(':react-native-call-log').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-call-log/android')
  • Edit your android/app/build.gradle (note: app folder) to look like this (exclude +)
dependencies {
+ compile project(':react-native-call-log')
   compile fileTree(dir: "libs", include: ["*.jar"])
   compile "com.android.support:appcompat-v7:23.0.1"
   compile "com.facebook.react:react-native:+"
}
  • Edit your MainApplication.java from ( android/app/src/main/java/...) to look like this (exclude +)
+ import com.wscodelabs.callLogs.CallLogPackage;

@Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
+         new CallLogPackage()
      );
    }

Permission

Add permission to android/app/src/mainAndroidMenifest.xml file

 <uses-permission android:name="android.permission.READ_CALL_LOG"></uses-permission>

Usage

 import CallLogs from 'react-native-call-log'
 
 // fetch call logs data
 
 CallLogs.show((logs) =>{
  // parse logs into json format
   const parsedLogs = JSON.parse(logs);
   
  // logs data format
  /*
    [
      { 
        phoneNumber: '9889789797', 
        callType: 'OUTGOING | INCOMING | MISSED',
        callDate: timestamp,
        callDuration: 'duration of call in sec',
        callDayTime: Date()
      },
      .......
     ]
  */
 });

Example

Clone or download the repository then Run cd Example && npm install

Screenshot

callrecord.jpg

react-native-call-log's People

Contributors

piyushcoader avatar aathapa avatar aayushgh avatar windless avatar djkmiles avatar p-tsai avatar peterchibunna avatar

Watchers

James Cloos avatar

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.