Android

You can browse our Android Docs below and navigate using the table of contents.

Overview

CredoApp SDK is a multi-modular android library. It captures a client’s digital footprint from a smartphone and uploads it to the CredoLab web-service for future processing of scorecards and fragments.

Below diagram shows the overview on how your mobile app work with CredoApp SDK:

To understand more about our credosdk modules and to learn how to integrate, please refer to our Integration Guideline section.

To understand more about our API and learn how to obtain scores, please refer to the API Integration section.

Download Android SDK

To download our SDK modules, please click on the link below:

Download SDK Modules

There are 6 different modules consisted of 6 permissions: 
1. Registered Account

2. Calendar

3. Contact

4. Media

5. Core

6. SMS

We recommend to download and integrate all modules into your Application.

However, feel free to customised the modules based on your use case.

What is a module?

You can easily customise the the SDK by adding different modules based on the permissions used in the application. Each module is presented as an AAR file that extracts different data types according to the table below.

Credoapp SDK Modules

Module Name Description
Core
credoapp.CredoAppService.Builder
credoapp.CredoAppResult
credoapp.CredoAppService 
Main module. Required

Extracts various metadata connected with device characteristics and configuration. This includes info about device brand, model, storage, total and available free memory, battery characteristics, Wi-Fi, Bluetooth, and other data describing the service.

Extracts information related to how many applications are installed on the device. This includes info about respective metadata connected with those apps, and features and existing permissions.
Account
credoapp,module.account.
RegisterAccountModule
Additional module.

Extracts metadata connected with user's accounts on the device. For example Gmail, Facebook, etc.
Calendar
credoapp.module.calendar.
RegisterAccountModule
Additional module.

Extracts metadata connected with calendar information presented on the device. This includes the info about events, attendees, and reminders.
Contact
credoapp.module.contact.
ContactModule

Additional module.

Extracts metadata connected with contacts and contacts group presented on the device.
SMS
credoapp.module.sms.
SmsModule
Additional module.

Extracts metadata connected with SMS presented on the device. 
Media
credoapp.module.media.
MediaModule
Additional module.

Extracts metadata connected with pictures, music, audios, videos, and download files that are located in the external storage. The storage is a physically removable storage such as an SD card.

Credoapp SDK Permission

Module Name Permissions Type
Core android.permission.INTERNET
android.permission.BLUETOOTH
android.permission.ACCESS_WIFI_STATE
android.permission.USE_FINGERPRINT
android.permission.QUERY ALL PACKAGES

android.permission.ACCESS_NETWORK_STATE
Normal Permission
Account android.permission.GET_ACCOUNTS* Dangerous Permission
Calendar android.permission.READ_CALENDAR* Dangerous Permission
Contact android.permission.READ_CONTACTS* Dangerous Permission
SMS android.permission.READ_SMS* Dangerous Permission
Media android.permission.READ_EXTERNAL_STORAGE* Dangerous Permission

Required Dependencies


implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.3'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.0' *

* — for Java project

How to integrate the credoapp SDK into an Android App

Preconditions

  1. Obtain a unique credoapp authentication key from credolab Representative(s) and use it during the data collection process. If you sign up via website, credolab Representative(s) will send you the authentication key 1-3 days upon sign up.
  2. For free trial user, the URL for the integration: https://scoring-sales.credolab.com/
  3. Download credolab's Android SDK modules
  4. The minSdkVersion must be set to 16 or higher to use these libraries
  5. The kotlin-stdlib must be 1.3.0 or higher to use these libraries

Integrate the credoapp SDK into your app

  1. Include credoapp SDK module AAR files into your android project
  2. Add permissions to AndroidManifest.xml from permissions table
  3. Add dependencies to build.gradle from dependencies table

Note: Make sure that you’ve added kotlin-stdlib if you’re using Java.

Logging credoapp SDK events

Credolab highly recommends logging the SDK events to gain information about the identification and analysis of a particular case. You can use a framework of your choice for this purpose. An example is below:

log("LogType", "CurrentTime_ActionName_RecordNumber")
log("LogType","CurrentTime_RecordNumber_CredoappExceptionType_CredoappExceptionMessage"‍

How to use the credoapp SDK

To start working with the credoapp SDK, firstly you need to create an instance of CredoAppService.

CredoAppService basic method:

execute. This method is intended to collect data from mobile phones and upload it to CredoLab web-service.

How to create a CredoAppService instance:

Kotlin


CredoAppService.Builder(applicationContext, serverURL, authKey)
	.addModule(MediaModule())
	.addModule(ContactModule())
	.addModule(CalendarModule())
	.addModule(SmsModule())
	.addModule(RegisterAccountModule())
	.build()

Java


new CredoAppService.Builder(getApplicationContext(), serverURL, authKey)
	.addModule(new MediaModule())
	.addModule(new ContactModule())
	.addModule(new CalendarModule())
	.addModule(new RegisterAccountModule())
	.build()

How to access Modules?


import credoapp.CredoAppResult
import credoapp.CredoAppService
import credoapp.module.account.RegisterAccountModule
import credoapp.module.calendar.CalendarModule
import credoapp.module.contact.ContactModule
import credoapp.module.media.MediaModule
import credoapp.module.sms.SmsModule

An example of credoapp usage in Kotlin


import credoapp.CredoAppResult
import credoapp.CredoAppService
import credoapp.module.account.RegisterAccountModule
import credoapp.module.calendar.CalendarModule
import credoapp.module.contact.ContactModule
import credoapp.module.media.MediaModule
import credoapp.module.sms.SmsModule

class CollectionActivity : AppCompatActivity() {
	private lateinit var credoAppService: CredoAppService

	override fun onCreate(savedInstanceState: Bundle?) {
		super.onCreate(savedInstanceState)
		setContentView(R.layout.activity_main)
		credoAppService = CredoAppService.Builder(applicationContext,
"https://scoring-sales.credolab.com", "**auth**key**")
			.addModule(ContactModule())
			.addModule(MediaModule())
			.addModule(CalendarModule())
			.addModule(RegisterAccountModule())
			.addModule(SmsModule())
			.build()
	findViewById

An example of credoapp usage in Java


import credoapp.CredoAppResult;
import credoapp.CredoAppService;
import credoapp.module.account.RegisterAccountModule;
import credoapp.module.calendar.CalendarModule;
import credoapp.module.contact.ContactModule;
import credoapp.module.media.MediaModule;
import credoapp.module.sms.SmsModule;

public class CollectionActivity extends AppCompatActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Button collectButton = findViewById(R.id.button);
		collectButton.setOnClickListener(view -> new Thread(() -> {
			String url = "https://scoring-sales.credolab.com";
			String authKey = "**auth**key**";
			String referenceNumber = "Unique reference number string";
			CredoAppService credoAppService = new
			CredoAppService.Builder(getApplicationContext(), url, authKey)
				.addModule(new MediaModule())
				.addModule(new ContactModule())
				.addModule(new CalendarModule())
				.addModule(new RegisterAccountModule())
				.addModule(new SmsModule())
				.build();

			CredoAppResult result = credoAppService.execute(referenceNumber);

			if (result instanceof CredoAppResult.Success) {
				Log.d(TAG, ((CredoAppResult.Success) result).getValue());
			} else {
CredoAppResult.Error error = (CredoAppResult.Error) result;
String errorMessage = (error.getMessage() + "--" + error.getCode());
Log.d(TAG, errorMessage);
			}
		}).start());
	}
}

Not sure where to trigger our SDK? refer to our FAQ section to understand more on where our clients commonly trigger the credoSDK and other collection of frequently asked questions.

Credoapp API Description

Credoapp Builder

credoapp.CredoAppService.Builder

Builder is responsible for creating the CredoAppService class instance.

Class builder

Description:

Creates an instance of CredoAppService with target configuration.

Signature:


CredoAppService.Builder(context: Context, url: String, authKey: String)

Parameters:

Name Description Type
context An instance of Context interface which could provide information about an application environment. android.content.Context
url The URL of credolab service.  string 
authkey  An authentication key can be obtained from the credolab team.  string 

Methods

addModule

Description:

Adds a module to the builder configuration.

Signature:


addModule(module: IModule) : CredoAppService.Builder

Parameters:

Name Description Type
module Requires one of the defined modules - Contacts Module IModule

Returns: credoapp.CredoAppService.Builder

build

Description:

Instantiates CredoAppService class instance.

Signature:


build(): CredoAppService

Parameters:

No

Returns:

Type Description
CredoAppService Creates an instance of CredoAppService with target configuration.

Credoapp Service

credoapp.CredoAppService

The CredoAppService facilitates the capture of a user’s digital footprint for future processing via the credolab web-service.

Methods

execute

Description:

Collects and uploads data from the smartphone to the credolab web-service and returns a reference number. This method performs networking operations and must not be called on the UI thread.

Signature:


execute(referenceNumber: String) : CredoAppResult

Parameters:

Name Description Type
referenceNumber Unique identifier intended to associate dataset, uploaded to CredoLab web-service, with a record on the lender side. (The max limit is 100 characters) string

Returns:

Type Description
CredoAppResult[String] Returns referenceNumber if upload succeeded.
CredoAppResult.Error Returns an error if something went wrong. Please refer to the error codes table.

getUngrantedPermissions

Description:

Returns the collection of non-granted Android permissions required by the CredoAppService.

Signature:


CredoAppResult> getUngrantedPermissions()

Returns:

Type Description
CredoAppResult[Array[String]] Returns an array of ungranted permissions.
CredoAppResult.Error Returns an error if something went wrong. Please refer to the error codes table.

Credoapp Result Success

credoapp.CredoAppResult<T>.Success

CredoAppResult.Success indicates a successful operation and contains a value.

Fields

Value

Description:

Returns operation value.

Signature:


value: T

Parameters:

No

Returns:

Type Description
T Returns value of generic type.

Credoapp Result Error

credoapp.CredoAppResult.Error

CredoAppResult.Error indicates an unsuccessful operation and contains the relative details.

Fields

message

Description:

Returns a message value of error.

Signature:


message: string

Parameters:

No

Returns:

Type Description
string Returns message value of error.

Code

Description:

Returns a code value of error.

Signature:


code: Int

Parameters:

No

Returns:

Type Description
Int Returns code of error. Please refer to the error codes table.

Error Codes

Status Code Reason Description
30 Duplicated areas error The extracting areas are duplicated.
40 Value is invalid The value is invalid.

Example:
Auth key is invalid
URL is invalid
41  Reference number is not unique or invalid Reference number already exists.

Example:
ReferenceNumber is not unique or invalid
42 Auth credentials are incorrect or action forbidden The provided credentials don't match. 
50 Server error  Something is wrong with the server. 
80 Network error Something is wrong with the network.
90  Unknown error  Unexpected error occured.