website logo
⌘
K
Introduction to Qualetics
Getting Started with Qualetics
Creating your account
Connecting your data
Data Streaming
Data Objects
Example Data Events & Objects
Automatic Data Capture
Custom Event Data
Error Monitoring
SDK For Data Streaming
JavaScript
Angular
React
React-Native
Rest API
Android
Qualetics for WordPress
Analytics
Activity Analytics
User Analytics
Exception Analytics
Features Overview
API Key Management
Features for Insights
Dashboards
Quick Look
User Management
User Groups
Dynamic Home Pages
Docs powered by
Archbee
SDK For Data Streaming

Android

8min

Installation

Add the JitPack repository to your build file in your root build.gradle at the end of repositories:

Java
|
...
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
...


Add Qualetics SDK to your apps build.gradle file.

Java
|
...
dependencies {
    implementation 'com.gitlab.Qualetics-SDK:qualetics-android:c1150c95c0'
}
...


In the same file under application - tag you need to define mqtt client service which is used as protocol for communicating with Qualetics servers.

Java
|
<application>
    ...
    <service android:name="org.eclipse.paho.android.service.MqttService"></service>
    ...
</application>


Usage

To use the SDK it first needs to be initialized

Java
|
QualeticsService qualetics = new QualeticsService(getApplicationContext(), APPLICATION_ID, APPLICATION_SECRET);


To set the appVersion parameter that is sent with the messages you can set it with:

Java
|
qualetics.setAppVersion("<Your Android App's version>");


To set default actor that will be sent with all messages without defined actor:

Java
|
HashMap attrs = new HashMap<String, Object>();
attrs.put("key", "value");
qualetics.useDefaultActor(new Actor("type", "id", new Actor("Type", "Id", attrs));


To set default actor to be stored from api call:

Java
|
qualetics.storeDefaultActorFromApiCall();


Then connect to server:

Java
|
qualetics.connect();


After connection is initialized it can be used to send events to the server

Java
|
QualeticsMessage message = new MessageBuilder()
    .action(new Action("ButtonClick", null))
    .actor(new Actor("User", "1234", null))
    .context(new Context("Button", "Button1", null))
    .object(new QualeticsObject("Button", "Button1", null))
    .build();

qualeticsService.sendMessage(message);




Updated 03 Mar 2023
Did this page help you?
PREVIOUS
Rest API
NEXT
Qualetics for WordPress
Docs powered by
Archbee
TABLE OF CONTENTS
Installation
Usage
Docs powered by
Archbee
Copyright @ 2022 All Rights Reserved | Qualetics Data Machines Inc.