These docs are for v2.6. Click to read the latest docs for v3.2.

Android SDK Reference

Class CredoAppService.Builder

CredoAppService.Builder is responsible for creating the CredoAppService class instance

CredoAppService.Builder(context: Context)

Parameters:

NameDescriptionType
contextAn instance of Context interface, which could provide information about an application environment.android.content.Context

Method CredoAppService.Builder.addModule(module: IModule)

addModule(module: IModule) : CredoAppService.Builder
  • The method adds a module to the builder configuration.

Parameters

NameDescriptionType
moduleRequires one of the following modulesIModule

Returns

CredoAppService.Builder


Method CredoAppService.Builder.addPlugin(plugin: IPlugin<*>)

addPlugin(plugin: IPlugin<*>) : CredoAppService.Builder
  • The method adds a plugin to the builder configuration.

Parameters

NameDescriptionType
pluginRequires one of the following pluginsIPugin

Returns

CredoAppService.Builder


Method CredoAppService.Builder.setIgnorePermissions(value)

 setIgnorePermissions(value: Boolean) : CredoAppService.Builder
  • The method sets if SDK should prevent the run of CredoAppService.collect() or execute() if permissions aren't granted.
  • The true value allows collecting dataset even if not all permissions are granted.
  • The false value restricts collecting dataset from running until all permissions are granted (including normal permissions).
  • The default value is true

Parameters

NameDescriptionType
valueRequires Boolean value true or falseBoolean

Returns

CredoAppService.Builder


Method CredoAppService.Builder.build()

build() : CredoAppService

Returns

configured CredoAppService instance.



Class CredoAppService

CredoAppService is responsible for capturing a client's digital footprint


Method CredoAppService.collect()

collect() : CredoAppResult<String>
  • Collects dataset and returns it locally. This method must not be called on the UI thread.
  • Does not accept any parameters

Returns

TypeDescription
CredoAppResult<String>If the collect method is succeeded, returns the string, which represents the array of bytes that is encoded to the base64 string
CredoAppResult.ErrorReturns an error if something goes wrong.
Please refer to the error codes table.

Method CredoAppService.getUngrantedPermissions()

getUngrantedPermissions(): CredoAppResult<Array<String>>

Returns

TypeDescription
CredoAppResult<Array<String>>Returns an array of ungranted permissions.
CredoAppResult.ErrorReturns an error if something goes wrong.
Please refer to the error codes table.

Class CredoAppResult<T>.Success

CredoAppResult.Success states for successful operation

Fields:

Field NameTypeDescription
valueTReturns value of generic type.

ClassCredoAppResult.Error

CredoAppResult.Error states for operation fail and contains error details

Fields:

Field NameTypeDescription
messageStringReturns the message value of the error.
codeIntReturns the code value of the error



Class BehavioralModule

BehavioralModule()

BehavioralModule is responsible for capturing a client's behavioral interaction with UI and OS


Static method BehavioralModule.startTracking()

startTracking()
  • Starts behavioral interaction metadata tracking

📘

When to invoke startTracking() ?

Before version 3.0.0 <= should be called as early as possible for instance, in desired activity onCreate() method. If you've version >= 3.0.0 you can invoke startTracking() in any place in your code.


Static method BehavioralModule.stopTracking()

stopTracking()
  • Terminates behavioral metadata tracking

Static method BehavioralModule.setLogger(plugin: IPlugin<ILogger>)

setLogger(plugin: IPlugin<ILogger>)

How to use BehavioralModule

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main) 
        val loggingPlugin = LoggingPlugin()
        
        BehavioralModule()
        BehavioralModule.setLogger(loggingPlugin)
        BehavioralModule.startTracking()
    }

    override fun onStop() {
        // calling stopTracking() method is optional
        BehavioralModule.stopTracking()
    }
}
public class MainActivity extends AppCompatActivity {
  @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      new BehaviouralModule();
      BehaviouralModule.setLogger(new LoggingPlugin());
      BehaviouralModule.startTracking();
   }
  
  @Override
  protected void onStop() {
      // calling stopTracking() method is optional
      BehaviouralModule.stopTracking();
  }
}



Error Codes

CodeReasonDescription
30Duplicated areas errorThe extracting areas are duplicated.
43Permissions are not grantedIf setIgnorePermissions configured method with false boolean value, SDK prevents you from proceeding without all the necessary permissions
90Unknown errorAn unexpected error occurred.