Giter Site home page Giter Site logo

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 {
        compile '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

  • Initialization
LogObject logObject = new LogObject(context);
```
  • 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:

```java
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

License

Copyright 2016 Wickerlabs.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

calllogs's People

Contributors

yusuphwickama avatar

Watchers

 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.