npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-call-logs

v0.1.3

Published

React native package for reading call logs(Android)

Readme

rn-call-logs

Simple react-native package for reading call logs from Android Devices(Only works with Android)

Installation

Use the package manager yarn or npm to install rn-call-logs.

yarn add rn-call-logs
npm install rn-call-logs

Android

The package is meant for react-native 0.60+, and should auto link everything. if auto-linking fails then will have to manually link things as in the old days :D

Usage

import * as React from 'react';

import {
  StyleSheet,
  View,
  Text,
  PermissionsAndroid,
  FlatList,
  TouchableWithoutFeedback,
} from 'react-native';
import {
  getAllLogs,
  getOutgoingLogs,
  getIncomingLogs,
  getMissedLogs,
  getRejectedLogs,
  getBlockedLogs,
  getExternallyAnsweredLogs,
  getByNumber,
  getNotConnectedLogs
} from 'rn-call-logs';

export default function App() {

  //interfaces
  interface logResponse {
    number: string;
    date: string;
    duration: string;
    country: string;
    type: string;
  }

  const [logs, setLogs] = React.useState<[logResponse] | []>();

  const getLogs = async () => {
    try {
      const granted = await PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.READ_CALL_LOG,
        {
          title: 'RN Call Logs',
          message: 'Access your call logs',
          buttonNeutral: 'Ask Me Later',
          buttonNegative: 'Cancel',
          buttonPositive: 'OK',
        }
      );
      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        try {
          const response: [logResponse] | [] = await getAllLogs({
            fromEpoch: 0,
            toEpoch: 0,
            limit: 10,
          });
          setLogs(response);
        } catch (error) {
          console.log(error);
        }
      } else {
        console.log('Call Log permission denied');
      }
    } catch (e) {
      console.log(e);
    }
  };

  React.useEffect(() => {
    getLogs();
  }, []);

  // UI Snippet from : https://www.itechinsiders.com/how-to-design-card-in-react-native/
  const renderItem = ({ item }: any) => (
    <TouchableWithoutFeedback>
      <View style={styles.mainCardView}>
        <View style={styles.cardInnerViewOne}>
          <View>
            <Text style={styles.cardMainText}>
              {item.number} ({item.country})
            </Text>
            <Text style={styles.cardSubText}>{item.type}</Text>
            <Text style={styles.cardSubText}>
              Duration: {item.duration} sec
            </Text>
            <Text style={styles.cardSubText}>
              Date:{new Date(parseInt(item.date)).toString()}
            </Text>
          </View>
        </View>
      </View>
    </TouchableWithoutFeedback>
  );

  return (
    <View style={styles.container}>
      <Text>Result:</Text>
      <FlatList
        data={logs}
        renderItem={renderItem}
        keyExtractor={(item) => item.date}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
  cardInnerViewOne: {
    flexDirection: 'row',
    alignItems: 'center',
  },
  cardMainText: {
    fontSize: 14,
    color: 'black',
    fontWeight: 'bold',
    textTransform: 'capitalize',
  },
  cardSubText: {
    color: 'gray',
    fontSize: 12,
  },
  mainCardView: {
    height: 90,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: 'white',
    borderRadius: 15,
    shadowColor: 'gray',
    shadowOffset: { width: 0, height: 0 },
    shadowOpacity: 1,
    shadowRadius: 8,
    elevation: 8,
    flexDirection: 'row',
    paddingLeft: 16,
    paddingRight: 14,
    margin: 10,
    minWidth: '90%',
  },
});

Response format on success

[
 {
    number: string; // phone number
    date: string; // epoch timestamp
    duration: string; // duration in seconds
    country: string; // 2 letter country code 
    type: string; // type of call ( 'INCOMING', 'OUTGOING','MISSED', 'VOICEMAIL',  
                                    'REJECTED', 'BLOCKED', 'EXTERNAL')
  }
]

Available Methods

  • getAllLogs()
getAllLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getOutgoingLogs()
getOutgoingLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getIncomingLogs()
getIncomingLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getMissedLogs()
getMissedLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getRejectedLogs()
getRejectedLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getBlockedLogs()
getBlockedLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getExternallyAnsweredLogs()
getExternallyAnsweredLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getNotConnectedLogs() //calls you made but didn't connected
getNotConnectedLogs({ fromEpoch: 0,toEpoch: 0, }); 
// fromEpoch and toEpoch are mandatory fields to get all data pass 0 as value for each.
// to get data in a date range pass epoch time in milliseconds
  • getByNumber()
getByNumber({ fromEpoch: 0,toEpoch: 0,phoneNumber: 123456789 }); 
// fromEpoch, toEpoch and phoneNumber are mandatory fields 
// to get all data pass 0 as value for fromEpoch and toEpoch.
// to get data in a date range pass epoch time in milliseconds

Options

| key | type | Required | Description | |--------------------------|--------|----------|----------------------------------------------------------------------------------------------------------------------------------------| | fromEpoch | Number | true | Starting time in epoch (milliseconds) for date based filtering, pass 0 for retrieving all data | | toEpoch | Number | true | Endingtime in epoch (milliseconds) for date based filtering, pass 0 for retrieving all data | | limit | Number | optional | To limit the results | | skip | Number | optional | To skip rows from result | | phoneNumber(getByNumber) | String | true | To search with a specific mobile number(only for getByNumber, do remember to omit country codes for getting better results) | | type(getByNumber) | Enum | Optional | 'INCOMING', 'OUTGOING', 'MISSED', 'VOICEMAIL', 'REJECTED', 'BLOCKED', 'EXTERNAL', 'ALL' To reterive only results of a specific type |

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

readme made with - makereadme.com

License

MIT