GithubHelp home page GithubHelp logo

kimxyz / calllogs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wickerlabs/calllogs

0.0 0.0 0.0 213 KB

Android library for accessing device call logs

Home Page: https://www.wickerlabs.com

License: BSD 2-Clause "Simplified" License

Java 100.00%

calllogs's Introduction

Call Logs - Android library for accessing device call logs

Android Arsenal

Image of the library in action

Installation

Step 1. Add the JitPack repository to your root build.gradle file.

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Step 2. Add the library dependency to your app build.gradle file

dependencies {
        implementation 'com.github.wickerlabs:CallLogs:1+@aar'
}

Step 3. Handle permissions (For API 23+)

For those targeting API 23+, 
you should handle the runtime permissions for READ_CONTACTS and READ_CALL_LOG. 
As a reference, check  out the sample app in the repository. 
Other than that, permissions are automatically added to the manifest file.

Usage

  • Initialization

    LogsManager logsManager = new LogsManager(context);
  • Getting a list of call logs

    List<LogObject> callLogs = logsManager.getLogs(type);
  • Available list types :

    LogsManager.INCOMING_CALLS: for getting the list (LogObject) of all the incoming calls.

    LogsManager.OUTGOING_CALLS: for getting the list (LogObject) of all the incoming calls.

    LogsManager.MISSED_CALLS: for getting the list (LogObject) of all the incoming calls.

    LogsManager.ALL_CALLS: for getting the list (LogObject) of all the calls.

  • Getting call durations

logsManager.getIncomingDuration(): returns the number of seconds for all the incoming calls made.

logsManager.getOutgoingDuration(): returns the number of seconds for all the outgoing calls made.

logsManager.getTotalDuration(): returns the number of seconds for all the calls made.

logsManager.getCoolDuration(type): returns a String in the form of "x hrs xx mins" or "xx mins xx secs"

  • Available duration types :

    LogsManager.INCOMING: for getting duration for all the incoming calls.

    LogsManager.OUTGOING: for getting duration for all the incoming calls.

    LogsManager.TOTAL: for getting duration for all the calls.

Using LogObjects

  • Some useful methods

logObject.getDuration(): returns an int of the seconds used for that particular call.

logObject.getNumber(): returns a String of the number associated with the call made.

logObject.getContactName(): returns a String of the contact name for the number in the log, if not found, it returns the number.

logObject.getType(): returns an int for the type of the call log.

logObject.getCoolDuration(): returns a String in the form of "x hrs xx mins" or "xx mins xx secs" based on the duration.

Examples

  • Retriving a list of all call logs:

     ListView logList = (ListView) findViewById(R.id.LogsList);
     LogsManager logsManager = new LogsManager(this);
     List<LogObject> callLogs = logsManager.getLogs(LogsManager.ALL_CALLS);
     LogsAdapter logsAdapter = new LogsAdapter(this, R.layout.log_layout, callLogs);
     logList.setAdapter(logsAdapter);

be sure to check out the sample app in the repository.

Acknowledgements

Icons made by madebyoliver from www.flaticon.com

calllogs's People

Contributors

yusuphwickama 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.