wickerlabs/calllogs


Android library for accessing device call logs https://www.wickerlabs.com

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.wickerlabs:CallLogs:1.09'
	}
	dependencies {
		implementation("com.github.wickerlabs:CallLogs:1.09")
	}
	<dependency>
	    <groupId>com.github.wickerlabs</groupId>
	    <artifactId>CallLogs</artifactId>
	    <version>1.09</version>
	</dependency>

                            
    libraryDependencies += "com.github.wickerlabs" % "CallLogs" % "1.09"
        
        

                            
    :dependencies [[com.github.wickerlabs/CallLogs "1.09"]]
        
        

Readme


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